Re: How do you create 2 listboxes in Oracle Forms 4.5?

From: Marcel Claus <Marcel.Claus_at_Informatik.Uni-Oldenburg.DE>
Date: Mon, 04 May 1998 14:58:56 +0100
Message-ID: <6ike0n$hmm_at_news.Informatik.Uni-Oldenburg.DE>


Creative Business Advisers wrote:

> I looked at some of the enclosed Oracle 4.5 Forms examples, but
> they didn't have quite what I need:
>
> Has anyone programmed a form with two listboxes where a user can
> click on an item in the first listbox and it is copied into the
> second listbox? Also, in this example, when an item in the second listbox
> is selected, it is removed.
>
> This seems to have been done already in TCL and Java, as you can
> get examples of this in numerous books. I think this can be
> done somehow with lists and/or LOVs.....
>
> If anyone has any ideas or hints how this could be implemented in
> Forms 4.5, it would greatly be appreciated.

  Hi,

maybe I don't understand the problem (I'm only a german programmer and sometimes I don't understand the meaning of English texts) but if I do the answer is really simple...
The easiest way to make two fields have the same contents is using mirror items.
You can set this in the propertie palette. I can't tell you the name of the propertie because
I'm using Forms 5.0 and there names are different. But just look for mirror-item
the on-line help. Make sure that the mirror-item is not a database item unless you
want two identical columns in the database. The second way is using a WHEN-LIST-CHANGED trigger for each of the listboxes. This trigger fires whenever someone has clicked in the field and changed
the contents using a predefined value from the pop-up-list. In the trigger you can
execute any statements you wish including a statement like LISTBOX2 := LISTBOX1. If you want to change the predefined values in the pop-up-list you have to create a
record group and attache it to an item (you can change the values during runtime).
The example below selects some data from the database (table the_tab, column the_col)
and changes the predefined values of a list-item (the_attr):

PROCEDURE MY_POPULATE_LIST (the_tab VARCHAR2,

                                           the_col VARCHAR2, the_attr
VARCHAR2) IS
  dum number;
  rg_id RecordGroup;
BEGIN
  rg_id := CREATE_GROUP_FROM_QUERY('DUMMY',

               'select ' || the_col || ', ' || the_col || ' "c2" from ' || the_tab || ' order by ' || the_col);
  dum := POPULATE_GROUP(rg_id);
  CLEAR_LIST(the_attr);
  POPULATE_LIST(the_attr, rg_id);
  DELETE_GROUP(rg_id);
END; Marcel Received on Mon May 04 1998 - 15:58:56 CEST

Original text of this message