Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: data structure problem

by graff (Chancellor)
on Nov 08, 2012 at 04:12 UTC ( [id://1002800]=note: print w/replies, xml ) Need Help??


in reply to data structure problem

Your hash of arrays idea seems like a perfectly sensible approach. Whether the structure is hard-coded or is somehow input-dependent, you can easily manage the BrowseEntry widgets:
... # populate %hash as per the OP # create $first_BrowseEntry, then: $first_BrowseEntry->insert( "end", $_ ) for ( sort keys %hash ); ... sub first_browse_callback { $second_BrowseEntry->delete( 0, "end" ); my $chosen = $first_BrowseEntry->get; $second_BrowseEntry->insert( "end", $_ ) for ( sort @{$hash{$chose +n}} ); }
There'll be more code than that, of course, but not a lot more. When you create the first_BrowseEntry widget, you'll include the "first_browse_callback" function as the "-browsecmd" option value.

(updated to use consistent naming on the widget variable)

Replies are listed 'Best First'.
Re^2: data structure problem
by perltux (Monk) on Nov 08, 2012 at 04:52 UTC
    Many thanks for your reply!

    It cleared my doubt whether I was on the right track with regards to the data structure and your 'first_browse_callback' code snippet helped me greatly with implementing the callback to modify the second widget based on the user selection of the first widget.
    My code is working fine now.

    You saved me from hours of frustrating experimentation! :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1002800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-18 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found