IT Employment



Oracle Forms item-property-setting problem

By john.a.wills ·
I have a data block with n records. One item in each record hights rwvbudg_perc_used. I want to have its foreground color depend on its magnitude. I have inserted the following PL/SQL code in the trigger post-change of the item.
if :rwvbudg_perc_used > 95
set_item_property (find_item('rwvbudg.rwvbudg_perc_used'), foreground_color, 'red');
set_item_property (find_item('rwvbudg.rwvbudg_perc_used'), foreground_color, 'black');
end if;
I have ascertained by tracing that the trigger is actually invoked and that the correct path within the if block is taken. There are values of the item displaying both above and below the criterion value, but no color change occurs, nor does any error message arise. What mistake might I be making?

With a lot of hunting around I have found that I should be using set_item_instance_property on the current record (set_item_property switches the whole column of the item back and forth in color). Alas, foreground_color is not an allowed value in set_item_instance_property; if I try to use it I get FRM-41383. An ideas?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

visual attributes

by john.a.wills In reply to Oracle Forms item-propert ...

I have solved the problem. An Oracle Form contains a list of objects of type Visual Attribute. Some come automatically with the libraries and so forth, and we can make more if we need to or want to. Although we cannot set a color with the built-in procedure set_item_instance property, we can set a visual attribute, and we can put colors in the visual attribute via its property palette. My final code is as follows:
if :rwvbudg_perc_used > 95
set_item_instance_property (find_item('rwvbudg.rwvbudg_perc_used'), current_record, visual_attribute, 'red_text'); --red
elsif :rwvbudg_perc_used < 40
set_item_instance_property (find_item('rwvbudg.rwvbudg_perc_used'), current_record, visual_attribute, 'blue_text'); --blue
set_item_instance_property (find_item('rwvbudg.rwvbudg_perc_used'), current_record, visual_attribute, 'g$_nva_text_item'); --black
end if;
where g$_nva_text_item is provided by Oracle automatically and was the model on which I based red_text and blue_text.

Related Discussions

Related Forums