Home » Developer & Programmer » Forms » Change the color of record base on condition (10G)
Change the color of record base on condition [message #335301] Mon, 21 July 2008 15:09 Go to next message
mhakimjavadi
Messages: 37
Registered: July 2008
Member
Hi,

I developed an oracle form and I would like to change the color of each record base some condition. I know I need to use set_item_instance_property and I am using some thing like this:

set_item_instance_property('MH_ID', current_record, visual_attribute, 'Gray_BG');

But I get FRM-41011 and I know that because I did not define visual_attribute correctly. Please help me about this and tell me how can I define visual_attribute and if it is possible send sample code for that.

Thank you in advance
Re: Change the color of record base on condition [message #335953 is a reply to message #335301] Thu, 24 July 2008 04:39 Go to previous messageGo to next message
gurupatham
Messages: 66
Registered: March 2008
Location: Chennai
Member
There is no specific code for creating visual attribute . In your form module , Just double click on the visual attributes module, visual attribute will be created with default name and setting. Go to the property palette of the VA and set the back ground color or font color as you would like.

then use it like
set_item_instance_property('MH_ID', current_record, visual_attribute, 'VA' );


Re: Change the color of record base on condition [message #336012 is a reply to message #335301] Thu, 24 July 2008 07:07 Go to previous message
Kaeluan
Messages: 179
Registered: May 2005
Location: Montreal, Quebec
Senior Member
Don't forget that set_item_instance_property will change the property of only 1 item, not the record. So your first parameter should be something like 'block.item' and not 'MH_ID'.
If you want to change the Visual Attribute of all item in the record, you will have to loop on each item and change the property for each of them.

You can use code like this to do that

DECLARE 
  cur_itm VARCHAR2(80);
  cur_block VARCHAR2(80) := :System.Cursor_Block; 
BEGIN 
  cur_itm := Get_Block_Property( cur_block, FIRST_ITEM ); 
  WHILE ( cur_itm IS NOT NULL ) 
  LOOP 
    cur_itm := cur_block||'.'||cur_itm;
    Set_Item_Instance_Property(cur_itm, 
                               CURRENT_RECORD,
                               VISUAL_ATTRIBUTE,
                               'My_Favorite_Named_Attribute'); 
    cur_itm := Get_Item_Property( cur_itm, NEXTITEM ); 
  END LOOP; 
END; 

Previous Topic: form prob
Next Topic: Developer Suite Installation issue
Goto Forum:
  


Current Time: Wed Mar 12 01:36:56 CDT 2025