Home » Developer & Programmer » Forms » Dynamic SET_ITEM_PROPERTY? (Oracle Forms Developer 10G,10.1.2.0.2 ,WinXP)
icon10.gif  Dynamic SET_ITEM_PROPERTY? [message #332207] Mon, 07 July 2008 21:34 Go to next message
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 #332216 is a reply to message #332207] Mon, 07 July 2008 23:06 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Hi
Try like this

You can pass as String 'Property_true' or 'Property_false' in stead of sending as Boolean value.

kanish
Re: Dynamic SET_ITEM_PROPERTY? [message #332239 is a reply to message #332216] Tue, 08 July 2008 00:18 Go to previous message
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' Sad

Thanks for the suggestion anyway Smile

[Updated on: Tue, 08 July 2008 00:20]

Report message to a moderator

Previous Topic: Multi-Line Button Labels in Forms 6i
Next Topic: Call Excel file from Forms
Goto Forum:
  


Current Time: Sat Dec 03 13:56:02 CST 2016

Total time taken to generate the page: 0.08349 seconds