It is a good idea, in an Oracle Forms application, to put a particular color on items when the user toggle to the Enter-Query mode.
Here are 2 PL/SQL generic procedures you can put into your own PL/SQL library to do the job.
You only need to create two visual attributes (VA_QUERY for the Query mode and VA_CURRENT_RECORD form the normal mode in this sample) with a BACKGROUND_COLOR set
The procedure that colorize the items in the ENTER-QUERY mode:
PROCEDURE Start_query IS
LC$Block Varchar2(30) := Name_in('system.trigger_block') ;
LC$item varchar2(60);
LC$itemdeb varchar2(60);
LN$len pls_integer ;
-- Procedure Start_query
--
-------------------------------------------
-- Colorize items in ENTER-QUERY mode --
-------------------------------------------
--
BEGIN
-- get the first item of the block --
LC$itemdeb := Get_Block_Property(LC$BLOCK, FIRST_ITEM) ;
LC$item := LC$BLOCK || '.' || LC$itemdeb ;
-- For every item of the current block --
While LC$itemdeb is not null Loop
IF Get_Item_Property(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
IF Get_Item_Property(LC$Item , QUERYABLE ) = 'TRUE' Then
Set_Item_Property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_QUERY');
End if ;
End if ;
-- next item --
LC$itemdeb := Get_Item_Property( LC$item, NEXT_NAVIGATION_ITEM );
LC$item := LC$BLOCK || '.' || LC$itemdeb ;
End loop ;
END;
You can call it in a KEY-ENTQUERY trigger:
BEGIN
Start_query;
Enter_query;
END;
The procedure that un-colorize the items after the EXECUTE_QUERY:
PROCEDURE End_query IS
-- Procedure End_query
--
------------------------------------------
-- Colorize items after EXECUTE-QUERY --
------------------------------------------
--
LC$Block Varchar2(30) := Name_in('system.trigger_block') ;
LC$item Varchar2(60);
LC$itemdeb Varchar2(60);
LN$Multi Pls_integer ;
BEGIN
-- get the first item of the current block --
LC$itemdeb := Get_Block_Property(LC$BLOCK, FIRST_ITEM) ;
LC$item := LC$BLOCK || '.' || LC$itemdeb ;
LN$Multi := Get_Block_Property(LC$Block , RECORDS_DISPLAYED ) ;
-- For every item of the current block --
While LC$itemdeb is not null Loop
If Get_Item_Property(LC$Item , ITEM_TYPE) NOT IN ('BUTTON','RADIO GROUP','DISPLAY ITEM') Then
If Get_Item_Property(LC$Item , QUERYABLE ) = 'TRUE' Then
If LN$Multi > 1 Then
Set_Item_Property(LC$item, CURRENT_RECORD_ATTRIBUTE, 'VA_CURRENT_RECORD');
Else
Set_Item_Property(LC$item, CURRENT_RECORD_ATTRIBUTE, '');
End if ;
End if ;
End if ;
-- next item --
LC$itemdeb := Get_Item_Property( LC$item, NEXT_NAVIGATION_ITEM );
LC$item := LC$BLOCK || '.' || LC$itemdeb ;
End loop ;
END;
You can call it in a KEY-EXEQRY trigger:
BEGIN
Execute_query ;
If :System.Mode <> 'ENTER-QUERY' Then
End_query;
End if ;
END;
And also in a KEY-EXIT trigger:
BEGIN
If :System.Mode = 'ENTER-QUERY' Then
End_query;
End if ;
Exit_form ;
END;