This content has been marked as final. Show 18 replies
Did you read the answers you got? It is not possible using the standard. What about putting a single button on top of all records?
Maha, CraigB's "Enable_Item" procedure does NOT enable or disable anything. As he wrote, "you will have to _*mimic*_ the Enabled/Disabled property"
You can NOT enable or disable items at the record level. All you can do is make them LOOK LIKE they are enabled or disabled.
Read what I wrote above -- make text items LOOK LIKE they are buttons, and use Craig's procedure to change their appearance -- at least the Visual Attribute part. I like to set the Border_Bevel property, too.
Finally, within the when-mouse-click trigger, you need to check the item's Visual Attribute, whether it is set to the Enabled or Disabled V.A., to determine whether the user should be allowed to run whatever that mouse-click does, since the when-mouse-click will run on all the records, no matter what visual attribute is assigned.
The most annoying part of using this workaround is that the mouse pointer remains a text-cursor vertical bar shape when you hover over the items that mimic buttons. When you hover the pointer over a button, it changes to a real arrow.
For the Button, Steve's suggestion of using a Text_Item that simulates a button would work, but your button code will only execute if the user clicks the "Button" with the mouse. If your users use both the mouse and the keyboard to activate the button this method will not work.
Since the application I work on requires keyboard and mouse support, I would stick with using the When-Button-Pressed trigger but add a check at the beginning to see if the Button is enabled or not. You will need to modify the ENABLE_ITEM procedure to work with buttons. For example:
Then, modify your When-Button-Pressed (WDP) trigger to add the following check:
PROCEDURE enable_item (inItem VARCHAR2, inRecord NUMBER, inEnabled BOOLEAN )IS paramCount NUMBER := 0; itemIsButton BOOLEAN := FALSE; BEGIN IF ( Get_Item_Property(inItem, ITEM_TYPE) = 'BUTTON' ) THEN itemIsButton := TRUE; END IF; IF ( inEnabled ) THEN IF ( NOT itemIsButton ) THEN Set_Item_Instance_Property(inItem, inRecord, INSERT_ALLOWED, PROPERTY_TRUE); Set_Item_Instance_Property(inItem, inRecord, UPDATE_ALLOWED, PROPERTY_TRUE); Set_Item_Instance_Property(inItem, inRecord, NAVIGABLE, PROPERTY_TRUE); END IF; Set_Item_Instance_Property(inItem, inRecord, VISUAL_ATTRIBUTE, 'ENABLED'); ELSE IF ( NOT itemIsButton ) THEN Set_Item_Instance_Property(inItem, inRecord, INSERT_ALLOWED, PROPERTY_FALSE); Set_Item_Instance_Property(inItem, inRecord, UPDATE_ALLOWED, PROPERTY_FALSE); Set_Item_Instance_Property(inItem, inRecord, NAVIGABLE, PROPERTY_FALSE); END IF; Set_Item_Instance_Property(inItem, inRecord, VISUAL_ATTRIBUTE, 'DISABLED'); END IF; END;
Your user can still click the button or use the keyboard to activate the button, but nothing will happen. You could even force the navigation cursor to move to a different item if you wanted too.
BEGIN IF ( NOT Get_Item_Instance_Property(:SYSTEM.TRIGGER_ITEM,:SYSTEM.TRIGGER_RECORD,VISUAL_ATTRIBUTE) = 'DISABLED' ) THEN /* execute your WBP Logic here... */ END IF; /* All button logic must be inside your Conditional */ END;
Hope this helps,
Hi CraigB ,
i have written procedure which is proposed you and in when button pressed trigger i have written like this.
IF ( NOT Get_Item_Instance_Property(:SYSTEM.TRIGGER_ITEM,:SYSTEM.TRIGGER_RECORD,VISUAL_ATTRIBUTE) = 'DISABLED' ) THEN
If :XXEAM_SHUTDOWN_DETAILS.WF_STATUS = 'Not Submited Yet!' then
enable_item('XXEAM_SHUTDOWN_DETAILS.WORK_ORDER_NO', :SYSTEM.TRIGGER_RECORD, TRUE);
else :XXEAM_SHUTDOWN_DETAILS.WF_STATUS = 'APPROVED' then
enable_item('XXEAM_SHUTDOWN_DETAILS.SEND', :SYSTEM.TRIGGER_RECORD, FALSE);