Highlight a Text Item in Oracle Forms With Visual Attribute

It is very necessary to highlight the current cursor text item in data entry forms so that a user can easily notice the current item.

Steps to highlight current item

1.   Create a visual attribute and set the background color (as per your choice) property as shown below:

Highlighting Text Item On Entry In Oracle Forms_代码
2.   Then write a When-New-Item-Instance trigger to specify the current visual attribute to an item, with the following code.
 
When-New-Item-Instance Trigger Code:
-- first get if item type is text item
Begin
IF GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM, ITEM_TYPE) = 'TEXT ITEM' THEN
-- you can take current item into global variable, it will help you in next trigger
    :GLOBAL.CRITEM := :SYSTEM.CURSOR_ITEM;
 
-- specify the attribute you just created

    SET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM, CURRENT_RECORD_ATTRIBUTE, 'RECATB');
-- high light the current item
END IF;
End;
3.   Then write Post-Text-Item trigger to restore the default color of a text item.
 
Post-Text-Item Trigger Code:
 
Begin
  IF :GLOBAL.CRITEM IS NOT NULL THEN
    -- you can specify your normal color attribute here
    SET_ITEM_PROPERTY(:GLOBAL.CRITEM, CURRENT_RECORD_ATTRIBUTE, 'Default');
  END IF;
End;
Now you can check the result by running your form.

Highlighting Text Item On Entry In Oracle Forms_代码_02