Home » Developer & Programmer » Forms » Setting the mouse position & restricting checkbox update
Setting the mouse position & restricting checkbox update [message #470195] Mon, 09 August 2010 05:20 Go to next message
ahazin
Messages: 39
Registered: August 2010
Member
Sorry, just something i havent come accross yet. I am simply wondering what name is used to reverence the mouse cursor in Forms.

I am trying to state that if the user reaches the last record in a file and clicks the mouse on the empty record below that they will get a message saying they are at the last record (basically so it means they have to manually click an add record button before they can add a new record)

I currently have this:

IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN
<something here> := :SYSTEM.LAST_RECORD;
MESSAGE('You are at the last record.');
ELSE
DOWN;

END IF;

Where i have <something here> is where i assume the refence for the mouse cursor should go, of which i dont know the name, am i correct?

Another thing is that I have a checkbox that is originally NO but when set to YES cannot be turned back to NO.

I have accomplished this by putting the following code in the WHEN_CHECKBOX_CHANGED trigger and it works fine. However it also updates the checkbox to NO and then back to YES, , as a result this brings up my Are you sure you want to update message. I originally thought that if i took out the :in_active := 'Y'; the FORM_TRIGGER_FAILURE would stop the checkbox being changed in the first place but this didnt appear to be the case. Just wondering if you guys would have any suggestions on how to accomplish this without letting it update at all (perhaps put something in the WHEN_VALIDATE trigger?

DECLARE
return_alert number;
BEGIN
if :in_active = 'N' THEN
return_alert := SHOW_ALERT('checkbox_alert');
:in_active := 'Y';
RAISE FORM_TRIGGER_FAILURE;

END if;
END;
Re: Setting the mouse position & restricting checkbox update [message #470198 is a reply to message #470195] Mon, 09 August 2010 05:33 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You have no control over the mouse cursor. You can control the text cursor - the line that appears in items when you click on them.
To move that, use one of: go_item, go_record, go_block, next_item, previous_item, next_record, prev......

To stop users modifying an item use set_item_instance_property to set the insert_allowed and update_allowed properties.
Re: Setting the mouse position & restricting checkbox update [message #470276 is a reply to message #470198] Mon, 09 August 2010 08:22 Go to previous messageGo to next message
ahazin
Messages: 39
Registered: August 2010
Member
thanks alot, both bits of info were very usefull I have one small problem though. I changed my code to:

IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN

previous_record;
MESSAGE('You are at the last record.');

ELSE
null;

END IF;

this is what i want it to do if the user clicks the cursor into a blank box, my form displays 10 records which may not all be filled, so say 5 are filled and the user clicks the blank space on row 6 to add a new record, i want to restrict this by making the cursor go up to the last record. This is what currently happens, but also, when the user clicks on the last record say box number 5, the cursor always goes up to box number 4, so record 5 is unselectable, any way round this?

Thanks so much for the help so far.
Re: Setting the mouse position & restricting checkbox update [message #470279 is a reply to message #470276] Mon, 09 August 2010 08:27 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Well in your example record 5 is the last record.
If you want to check if the user is in an empty record check the :system.record_status - it will be NEW.
If you're not careful though that same check will prevent you creating a new record via a button as well - depends what triggers you use.
Re: Setting the mouse position & restricting checkbox update [message #470332 is a reply to message #470279] Mon, 09 August 2010 10:17 Go to previous messageGo to next message
ahazin
Messages: 39
Registered: August 2010
Member
got it working perfectly now, thanks very much. There seems to be so many things such as the :system etc that needs to be learnt. I guess it all comes with experiance.

Again, thank you.
Re: Setting the mouse position & restricting checkbox update [message #470344 is a reply to message #470332] Mon, 09 August 2010 10:41 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have a read of the "List of system variables" topic in form builder help.
Previous Topic: FMX to FMB ?!
Next Topic: how to create the relation of two forms on 6i
Goto Forum:
  


Current Time: Thu Sep 19 17:24:54 CDT 2024