in reply to Re^2: problem with Tk::JComboBox
in thread problem with Tk::JComboBox

Which interference are you refering to? I just installed JComboBox and tested all the scripts superficially and they seemed to work as expected (Apart from the bug(?) with @TestList1 in the callback)

Replies are listed 'Best First'.
Re^4: problem with Tk::JComboBox
by zentara (Cardinal) on Sep 22, 2008 at 20:40 UTC
    In my code above, when you run it, and hit the down arrow on the top box, then browse the selections, the browsecmd callback will say Browse 1. So the selections to the top box only should change. BUT if you then proceed to the bottom box 2, it's selections will have been changed too, without browsing them.

    The reverse is not the same. If you restart the app, and browse the lower box 2, it will change it's selections. Then proceed to the top box 1, and it's selections have not changed.

    Also, if you browse box 1 first, it will print Browse 1 only when you actually browse the selections. Then if you go to the down arrow on box 2, it will print Browse 1, on the arrow press of box 2. Maybe it's a focus thing, but it sure seems like there is something wrong with the way the browsecmd works with multiple boxes.


    I'm not really a human, but I play one on earth Remember How Lucky You Are

      That is not a bug, it's a feature. JComboBox recognizes when you use the same var for more than one box. The first box is called the master, all the others observer. If you change the master, the observers follow.

      Really a strange "feature" IMHO, but it is documented, in the section "The Choices option" of the JComboBox docs

        That is not a bug, it's a feature...... a Really a strange feature

        Where have I heard that before? :-)


        I'm not really a human, but I play one on earth Remember How Lucky You Are
Re^4: problem with Tk::JComboBox
by Anonymous Monk on Sep 27, 2008 at 07:07 UTC
    how can i achive as you mentioned as bug.
    even i won't use only one place, i will use dependent select combo's in differt screens.
    Please suggest me.
      You mean the feature of connected boxes? I did say it is a feature, not a bug. And you can use it by creating an array and using a reference to it as a -choices parameter. For example:
      my @array= ('1', '2','123'); my $box1 = $Screen->JComboBox( ... , -choices= \@array ); my $box2 = $Screen->JComboBox( ... , -choices= \@array );

      As long as you use a reference to the same array, the boxes are in sync to the first box, the master. At least that's how I understood the documentation.