It's fairly easy to use.
1. Create two Visual Attributes. One named VA_SET and one named VA_UNSET
2. In VA_UNSET, set the attributes as desired for when the item is not the current item. For example, black foreground and a white background (and any other desired settings)
3. In VA_SET, set the attributes as desired for when the item is the current item. For example, set the background color to yellow or other noticeable color. You can even use one of the colorscheme colors. For example, try setting background color to one of the OLAF colors. This will pick up colors from the "colorscheme" palette. The image below is the palette for SWAN Setting the font weight to bold is also helpful.
4. Create a form or block level WHEN-NEW-ITEM-INSTANCE trigger with the code from the example.
Just Implemented your code using WHEN-NEW-ITEM-INSTANCE trigger.
It has a logical bug.
It does not UN-SET the Current item's VA if Next Item is other than TEXT ITEM.
This seems like an easy fix. I've reviewed the code and simplified it a bit, as well as addressing the issue you mentioned.
Declare ui_type varchar2(11); Begin -- Set defaults for globals Default_Value(:system.cursor_item,'global.prev_item'); Default_Value(:system.cursor_record,'global.prev_record'); -- Only change colors if item is a TEXT ITEM ui_type := GET_ITEM_PROPERTY(:system.cursor_item, ITEM_TYPE); -- Is the cursor item a text item? If upper(ui_type) = 'TEXT ITEM' Then -- Reset the background color of the item just exited set_item_instance_property(:global.prev_item, to_number(:global.prev_record), VISUAL_ATTRIBUTE,'VA_UNSET'); -- Set the new background color set_item_instance_property(:system.cursor_item, current_record, VISUAL_ATTRIBUTE,'VA_SET'); Else -- Reset the background color of the previous item when current is not text set_item_instance_property(:global.prev_item, to_number(:global.prev_record), VISUAL_ATTRIBUTE,'VA_UNSET'); End if; -- Prepare for next item instance. Set previous item to the current item :global.prev_item := :system.cursor_item; :global.prev_record := :system.cursor_record; End;
Can you please explain? Whats is OLAF colors and how to use it?
The OLAF (Oracle Look and Feel) colors represent the virtual colors used by the colorSchemes. Being able to access these colors allows you to use colors that were designed to complement each other rather than choosing randomly selected colors on your own. The valid OLAF colors that can be used as a value in place of actual colors (e.g. red, blue, etc) are:
Refer to the Builder Help in Forms 188.8.131.52. Specifically look at the Help for Background or Foreground Color Property
Also, take a look at MyOracle Support Note 2367517.1 This note provides a hint as to what the provided palette colors include.