Home » Developer & Programmer » Forms » change records visual attribute depending on certain conditions (Forms 10g 10.1.2.0.2 , windows xp)
change records visual attribute depending on certain conditions [message #515658] Tue, 12 July 2011 13:35 Go to next message
aaichah
Messages: 24
Registered: July 2011
Location: Ottawa
Junior Member
CM: 2 merged



hi,
I have a database block that refreshes using a timer.
In short, I list all open work pieces for a certain garage, displaying route, run, on_time, of_time, location grouped by garage, on_time, off_time

I need to highlight every garage with a different color
I am highlighting the on_time everytime the garage changes.

The problem is, everytime I move down the records, instead of keeping the previous garage color, and highlight the new garage on_time with a new color, the whole on_time colomun will be set to the current garage color.

I need to break down the block by color so the user can distinguish between the different garages, and the start and end time.

Here is my code, I am putting it in when_new_record_instance of the work_block:

IF :work_bLock.current_garage = 9006 THEN
Set_Item_Property('work_block.on_time', BACKGROUND_COLOR, 'r191g223b191');
ELSIF :work_bLock.current_garage = 9002 THEN
Set_Item_Property('work_block.on_time', BACKGROUND_COLOR, 'r255g228b196');
ELSE
Set_Item_Property('work_block.on_time', BACKGROUND_COLOR, 'r255g250b250');
END IF;

I need the block to be 3 or more different colors depending on the garage
Can this be done at run time?

Thank you

[Updated on: Tue, 12 July 2011 14:07] by Moderator

Report message to a moderator

Re: change records visual attribute depending on certain conditions [message #515662 is a reply to message #515658] Tue, 12 July 2011 14:07 Go to previous messageGo to next message
cookiemonster
Messages: 13777
Registered: September 2008
Location: Rainy Manchester
Senior Member
Use set_item_instance_property
Re: change records visual attribute depending on certain conditions [message #515861 is a reply to message #515658] Wed, 13 July 2011 14:47 Go to previous messageGo to next message
aaichah
Messages: 24
Registered: July 2011
Location: Ottawa
Junior Member
That worked great
here is the code that works for the question above:
in the post_query of the database block:
IF :work_bLock.current_garage = 9002 THEN
set_item_instance_property( 'work_block.current_garage', CURRENT_RECORD, VISUAL_ATTRIBUTE, 'DISPLAY_CRRNT_VA' );
ELSIF :work_bLock.current_garage = 9006 THEN
set_item_instance_property( 'work_block.current_garage', CURRENT_RECORD, VISUAL_ATTRIBUTE, 'ALERT_VA' );
END IF;
Re: change records visual attribute depending on certain conditions [message #660883 is a reply to message #515861] Tue, 28 February 2017 05:52 Go to previous messageGo to next message
nido143
Messages: 7
Registered: February 2017
Junior Member
Hi,
I have a problem with visual attributes. I have set current record visual attribute as 'PINK'. Then I have put two triggers on form level:

1.WHEN-NEW-ITEM-INSTANCE and code for this "SET_ITEM_INSTANCE_PROPERTY(:SYSTEM.CURRENT_ITEM,CURRENT_RECORD,VISUAL_ATTRIBUTE ,'YELLOW')" this is to change the background color of current item not whole record.

2.POST-TEXT-ITEM and code for this is:
"SET_ITEM_INSTANCE_PROPERTY(:SYSTEM.CURRENT_ITEM,CURRENT_RECORD,VISUAL_ATTRIBUTE ,'PINK')" this changes the background color of previous item again 'PINK' which is current record attribute.

Now I want to change the previous record background color as DEFAULT i.e, 'WHITE' but this in not changing...the background color of all previous records remains 'PINK'.....

How can I do this.....

kindly tell me the procedure.....


Re: change records visual attribute depending on certain conditions [message #660887 is a reply to message #660883] Tue, 28 February 2017 07:55 Go to previous messageGo to next message
Littlefoot
Messages: 21530
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Switch to PRE-RECORD trigger.
Re: change records visual attribute depending on certain conditions [message #660998 is a reply to message #660887] Sat, 04 March 2017 00:46 Go to previous messageGo to next message
nido143
Messages: 7
Registered: February 2017
Junior Member
kindly send the code for this trigger and where to use this trigger....
Re: change records visual attribute depending on certain conditions [message #661014 is a reply to message #660998] Sun, 05 March 2017 01:57 Go to previous messageGo to next message
nido143
Messages: 7
Registered: February 2017
Junior Member
Hi,
I have a problem with visual attributes. I have set current record visual attribute as 'PINK'. Then I have put two triggers on form level:

1.WHEN-NEW-ITEM-INSTANCE and code for this "SET_ITEM_INSTANCE_PROPERTY(:SYSTEM.CURRENT_ITEM,CURRENT_RECORD,VISUAL_ATTRIBUTE ,'YELLOW')" this is to change the background color of current item not whole record.

2.POST-TEXT-ITEM and code for this is:
"SET_ITEM_INSTANCE_PROPERTY(:SYSTEM.CURRENT_ITEM,CURRENT_RECORD,VISUAL_ATTRIBUTE ,'PINK')" this changes the background color of previous item again 'PINK' which is current record attribute.

Now I want to change the previous record background color as DEFAULT i.e, 'WHITE' but this in not changing...the background color of all previous records remains 'PINK'.....

How can I do this.....

kindly tell me the procedure.....

The form is attached for convenience......
Re: change records visual attribute depending on certain conditions [message #661027 is a reply to message #661014] Sun, 05 March 2017 20:20 Go to previous messageGo to next message
JohnGuru
Messages: 6
Registered: March 2017
Junior Member
Try this option in Post-Record Trigger -

Set_Record_Property('BL_NAME' , Current_record , Visual_Attribute , NULL); 
-- If NULL is not working , create a VA with White Background & replace it.
Re: change records visual attribute depending on certain conditions [message #661217 is a reply to message #661027] Fri, 10 March 2017 23:09 Go to previous messageGo to next message
nido143
Messages: 7
Registered: February 2017
Junior Member
Dear this is not working...............

which keyword is used for previous record...I have to change the color of previous record.

can anybody help me please........

[Updated on: Fri, 10 March 2017 23:11]

Report message to a moderator

Re: change records visual attribute depending on certain conditions [message #661220 is a reply to message #661217] Sat, 11 March 2017 01:38 Go to previous message
Littlefoot
Messages: 21530
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As you were already told: PRE-RECORD and POST-RECORD triggers are the ones to be used. In PRE-RECORD set visual attributes of the records you are navigating to (for example, make the items pink). In POST-RECORD, which fires when you're navigating out of that record, set them back to "default" state (for example, white).
Previous Topic: How to Find Updated Rows in Oracle Forms 10 g
Next Topic: How to call Matching Record
Goto Forum:
  


Current Time: Sat Jan 18 17:05:06 CST 2020