Dynamic SET_ITEM_PROPERTY? [message #332207] |
Mon, 07 July 2008 21:34 |
balot
Messages: 2 Registered: July 2008
|
Junior Member |
|
|
Hi, I've ran into a small problem, maybe you guys have encountered the same. Basically the code below enables and disables a set of different text items depending on the conditional statement's output.
DECLARE
vErrCode number;
BEGIN
IF TRIM(:RGREINSTATEMENT) = 'UPDATING'THEN
--ENABLE UPDATING CONTROLS
SET_ITEM_PROPERTY('TEXTITEM1',ENABLED, PROPERTY_TRUE);
SET_ITEM_PROPERTY('TEXTITEM2',ENABLED, PROPERTY_TRUE);
ELSE
--ENABLE REDATING CONTROLS
SET_ITEM_PROPERTY('TEXTITEM1',DISABLED, PROPERTY_FALSE);
SET_ITEM_PROPERTY('TEXTITEM2',DISABLED, PROPERTY_FALSE);
END IF;
END;
This is redundant. Is there a way to pass a parameter to the SET_ITEM_PROPERTY, replacing "PROPERTY_FALSE" or "PROPERTY_TRUE" with a boolean equivalent?
I plan to put this conditional block in a program unit applying the code block below with a boolean value as passing parameter... let's pretend that the parameter vState's value is TRUE...
PROCEDURE switchControls(vState)
SET_ITEM_PROPERTY('TEXTITEM1',ENABLED, vState);
SET_ITEM_PROPERTY('TEXTITEM2',ENABLED, vState);
END PROCEDURE;
The code above will enable or disable the text items, depending on the boolean value passed as a parameter. So in this example, we passed TRUE, which could then (hopefully) tell the oracle forms that we are passing the 'PROPERTY_TRUE' value to the SET_ITEM_PROPERTY built-in.
So after this code is made, I could just apply it to my original code as the example below...
DECLARE
vErrCode number;
BEGIN
IF TRIM(:RGREINSTATEMENT) = 'UPDATING'THEN
--ENABLE CONTROLS
switchControls(TRUE);
ELSE
--DISABLE CONTROLS
switchControls(FALSE);
END IF;
END;
Now I can reuse this program unit to other forms similar to this one and the code in the form looks cleaner and therefore easier to debug. Thanks for reading, I hope someone has a solution for this one.
Can there be an equivalent substitute for the PROPERTY_FALSE and PROPERTY_TRUE value?
[Updated on: Mon, 07 July 2008 21:42] Report message to a moderator
|
|
|
|
Re: Dynamic SET_ITEM_PROPERTY? [message #332239 is a reply to message #332216] |
Tue, 08 July 2008 00:18 |
balot
Messages: 2 Registered: July 2008
|
Junior Member |
|
|
mm_kanish05 wrote on Tue, 08 July 2008 12:06 | Hi
Try like this
You can pass as String 'Property_true' or 'Property_false' in stead of sending as Boolean value.
kanish
|
yep, it's what I did, but that would be repetitive. Imagine if I had to disable/enable several text items with different blocks.
I tried doing this too...
DECLARE
vString varchar2(20):='PROPERTY_FALSE';
BEGIN
SET_ITEM_PROPERTY('BLOCK1.TEXTITEM1',ENABLED,TRIM(vString));
END;
The code above resulted in an error. That's because the 3rd parameter of SET_ITEM_PROPERTY cannot accept the string value 'PROPERTY_FALSE'
Thanks for the suggestion anyway
[Updated on: Tue, 08 July 2008 00:20] Report message to a moderator
|
|
|