Thursday, November 16, 2006

How To Retrieve All Blocks & Items From Any Form

PROCEDURE Get_Canvas_Names IS
lc$blockDeb varchar2(60); -- start block
lc$block varchar2(60); -- current block name
lc$item varchar2(60); -- current item
lc$Type varchar2(20); -- item type
lc$itemdeb varchar2(60); -- first item
lc$canvas varchar2(60); -- current canvas name
lc$tabcan varchar2(60); -- current tab canvas name
lc$Acanvas varchar2(60):= ' '; -- old canvas name
lc$Atabcan varchar2(60):= ' '; -- old tab canvas name
ln$NbRec pls_integer:=0;-- number of records(for know if the block is multi-records)

BEGIN

LC$BlockDeb := get_form_property( NAME_IN('System.Current_Form'), FIRST_BLOCK ) ;
LC$Block := LC$BlockDeb ;

Loop -- For each block of the form

LN$NbRec := get_block_property(LC$BLOCK, RECORDS_DISPLAYED) ;
lc$itemdeb := get_block_property(LC$BLOCK, FIRST_ITEM) ;

lc$item := LC$BLOCK '.' lc$itemdeb ;

while lc$itemdeb is not null loop -- For each item

-- visible item ? --
IF GET_ITEM_PROPERTY(LC$Item , VISIBLE) = 'TRUE' Then

-- Get the canvas and tab canvas name --
lc$canvas := GET_ITEM_PROPERTY(LC$Item , ITEM_CANVAS ) ;
lc$tabcan := GET_ITEM_PROPERTY(LC$Item , ITEM_TAB_PAGE ) ;


End if ; -- GET_ITEM_PROPERTY(LC$Item , VISIBLE) = 'TRUE'

lc$itemdeb := get_item_property(lc$item, NEXT_NAVIGATION_ITEM );
lc$item := LC$BLOCK '.' lc$itemdeb ;

end loop ;


LC$Block := get_block_property( LC$Block, NEXTBLOCK ) ; -- next block

exit when LC$Block is null ;

End loop ;

END Get_Canvas_Names;

Note This method only works when you load the form into the memory.
i.e it means you have to call the form

No comments: