Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing prompt colour in oracle forms 6i to canvas background (solution)

55240Apr 22 2004 — edited Apr 22 2004
One of the really infuriating things about Oracle Forms 6i (and possibly other versions) is that when you set a visual attribute for a item the prompt, as well ad field, takes that background colour. Seing it is common to have the field background white and the canvas background gray this is a paid. The following procedure sets the background colour for all prompts to the background colour of the canvas the prompts field sites on - i.e. it automaticaly sorts out the problem.

PROCEDURE lp_setup_prompt_colour IS
--
-- This procedure sets the background colour of all prompts to the
-- items canvas background colour
--
this_block varchar2(70) :=
get_form_property (name_in ('SYSTEM.CURRENT_FORM'), first_block);
last_blockname constant varchar2 (70) := -- Initialise current block to first block
get_form_property (name_in ('SYSTEM.CURRENT_FORM'), last_block); -- Define the last block
field_name varchar2(70); -- the name of the current item
this_item varchar2(70) := -- Initialise current item to the first item in the form
get_block_property (this_block, first_item);
last_field varchar2 (70) := -- Initialise last item to the last item in the first block
get_block_property (this_block, last_item);
canvas varchar2(70);

begin
loop -- Go through every item in the form

field_name := this_block || '.' || this_item; -- set the current item
canvas := get_item_property( field_name, ITEM_CANVAS );

if canvas is not null then -- don't bother if null canvas item
SET_ITEM_PROPERTY(field_name, PROMPT_BACKGROUND_COLOR,
GET_CANVAS_PROPERTY(canvas ,BACKGROUND_COLOR));
end if;

-- Stop looping once the last item in the form has been added to the list
exit when this_block = last_blockname and this_item = last_field;

if this_item = last_field then -- weve looped round and are back at first field
-- Step into the next block
this_block := get_block_property (this_block, nextblock);
this_item := get_block_property (this_block, first_item);
last_field := get_block_property (this_block, last_item);
else
-- Step to the next item in the block
this_item := get_item_property (field_name, nextitem);
end if;

end loop;

end;

also posted at http://www.gurtlush.org.uk/article.php?story=20040422141050964
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2004
Added on Apr 22 2004
1 comment
174 views