Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: perltk: error getting values from dynamically generated combo boxes

by SuicideJunkie (Vicar)
on May 07, 2012 at 20:05 UTC ( #969323=note: print w/replies, xml ) Need Help??

in reply to perltk: error getting values from dynamically generated combo boxes

Tk::Error: bad listbox index "": must be active, anchor, end, @x,y, or a number at /usr/intel/pkgs/perl/5.8.5/lib/site_perl/5.8.5/x86_64-linux/ line 247

So. You're giving a listbox index that is either an empty string or perhaps undef. The solution is to not do that :)

Try printing out the values you're using, and then see where the bad value is coming from.

You could also make a temporary tweak to, and have it confess instead.

Replies are listed 'Best First'.
Re^2: perltk: error getting values from dynamically generated combo boxes
by ruhroh (Initiate) on May 07, 2012 at 21:30 UTC

    The problem is that:

    $field_id = $listb$listb_index -> curselection();

    only returns a value if it is retrieving a value from the last listbox created. Otherwise, it will return a value "". I have been looking at the documentation for listbox from: . But I don't know why my script can't retrieve the values from the first created listbox.

    UPDATE: I did a check to see if the previous listboxes existed by just doing a get(0). They all print out dog as expected.

    So the problem is why doesn't curselection not work on the old listboxes and only the most recently "added" listbox?

      I tried to look back where your $listb is coming from. (needs a better name BTW - I've no idea what it is for) and it got confusing pretty quick.

      I suggest regenerating your indentation with perltidy, and taking a closer look at @content and the repeated ties. I'm not familiar with tie, but I'd guess that you're making a giant knot out of all your gui elements there.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://969323]
and a soft breeze sighs...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2018-05-24 22:43 GMT
Find Nodes?
    Voting Booth?