'Enable/Disable Item based on the value of the List Item
I am trying to code a listItem which will have 2 values "New" and "Edit". I also have a search (Push Button) in the same canvas. I want to disable the Search button when I have selected "new" in the list item and enable it when "Edit" is selected in the list item.
Here is my code : I am using Oracle Forms 6i , WHEN_LIST_CHANGED Trigger ..
begin
if :CONTROL.LI_DO='New' then
go_item('PB_SEARCH');
SET_ITEM_PROPERTY('PB_SEARCH',enabled,property_false);
else if :CONTROL.LI_DO='Edit' then
go_item('PB_SEARCH');
SET_ITEM_PROPERTY('PB_SEARCH',enabled,property_true);
end if;
end if;
end;
Any help is appreciated .
Solution 1:[1]
Been a while since I did forms, but can you disable an item that has current focus?
I.e. navigate (GO_ITEM) to another item then try to disable PB_SEARCH.
Solution 2:[2]
LI_DO.Functional."Elements in List" : New (value 0), Edit (value 1);
LI_DO.Data."Data Type" : Number;
LI_DO."Initial Value" : 1;
LI_DO.Required : "Yes";
After those regulations, you may use the code below for "WHEN-LIST-CHANGED";
begin
if :CONTROL.LI_DO = 0 then
--go_item('PB_SEARCH');
SET_ITEM_PROPERTY('PB_SEARCH',enabled,property_false);
--else if :CONTROL.LI_DO = 1 then
elsif :CONTROL.LI_DO = 1 then
--go_item('PB_SEARCH');
SET_ITEM_PROPERTY('PB_SEARCH',enabled,property_true);
end if;
--end if;
end;
Solution 3:[3]
You have to know the concept of using enabled property. The following blog illustrate this with an example clears the point of misunderstanding of using 'enabled'property alone.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TenG |
| Solution 2 | Community |
| Solution 3 |
