Re: set_item_instance_property

From: Eric C. Janzen <ejanzen_at_telusplanet.net>
Date: Thu, 09 Dec 1999 15:48:54 GMT
Message-ID: <GbQ34.27167$n3.410257_at_news1.telusplanet.net>


Brian, you can't use SET_ITEM_INSTANCE_PROPERTY to change the property of a row unless it is the current row. From the forms help:

"Note that SET_ITEM_INSTANCE_PROPERTY only affects the display of the current instance of the item; other instances of the specified item are not affected. This means that if you specify a display change for an item that exists in a multi-record block, SET_ITEM_INSTANCE_PROPERTY only changes the instance of that item that belongs to the block's current record. "

So, if you want to change the background of the first item on the second row, when it isn't the current row, you have to programatically navigate to that row and then use the SET_ITEM_INSTANCE_PROPERTY to change the attribute.

So a program unit that would set the attribute of item one on row "n" would look like

PROCEDURE set_attr(n IN NUMBER) IS
BEGIN
  first_record;
  FOR i in 1..n-1 LOOP
    next_record;
  END LOOP; set_item_instance_property('block1.item1',VISUAL_ATTRIBUTE,'VA_BACKGROUND_RE D');
END; Of course, there is a problem in that the focus is now on the record whose attribute you just changed. So to ensure that you go back to the record you were on, you would have to count the records as you navigate through them, say using key-nxtrec and key-prvrec triggers that sets a global like follows:

KEY-NXTREC
:global.record_number := :global.record_number +1;

KEY-PRVREC
:global.record_number := :global.record_number -1;

(Ensure that you initialize the global in the WHEN-NEW-FORM-INSTANCE)

Then the above program unit would become:

PROCEDURE set_attr(n IN NUMBER,origitem In VARCHAR2) IS BEGIN
  first_record;
  FOR i in 1..n-1 LOOP
    next_record;
  END LOOP; set_item_instance_property('block1.item1',VISUAL_ATTRIBUTE,'VA_BACKGROUND_RE D');
  first_record;
  BEGIN
  first_record;
  FOR i in 1..:global.record_number-1 LOOP     next_record;
    go_item(origitem);
  END LOOP;
END; Then to set the attribute and return to the item that you are coming from, call it as follows:

set_attr(2, name_in (:system.cursor_item));

This is untested, so may have some flaws...hope it works...

--
--------------------------------------------------
Eric Janzen
E. Janzen Consulting Inc.
Oracle Development Specialist
--------------------------------------------------






Brian Neary <bneary_at_gnosis-is.com> wrote in message
news:H9D34.160$lz3.379374_at_news.bctel.net...

> Forms 5.0
>
> In a tabular form showing 15 records of a block, I want to change the
> background color of one of the rows or one of the items in one of the
rows.
> I'm not referring to the current row.
> I've tried using the set_item_instance_property but can't get it to work.
>
>
set_item_instance_property('block1.item1',VISUAL_ATTRIBUTE,2,'VA_BACKGROUND_
> RED');
>
> I was expecting item1 in the 2nd row to have a red background but I get a
> message stating that the property is invalid, however, the item does have
a
> visual_attribute property and the help states that visual_attribute is a
> valid property to set using this built-in.
>
> I've actually never got the set_item_instance_property built-in to work.
>
> Any help will be appreciated.
>
> Brian
>
>
Received on Thu Dec 09 1999 - 16:48:54 CET

Original text of this message