Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This is the scenario:

I have a few arrays (here it's three but in reality I have more):
@preset = qw(tom snare metal analog); @card1 = qw(mellowstr brightstr string3); @ram = qw(acoustic rock bass jazz strato distorted);

now I want to have two interdependent PerlTK BrowseEntry widgets:

The first one should let me choose one of the arrays (preset or card1 or ram), while the second one will let me choose one of the elements from the array chosen in the first BrowseEntry widget.

The BrowseEntry widget needs an array as 'choices' parameter and saves the choice in a string variable.

What I'm struggling with is how to create a suitable data structure for this, I was trying with an additional hash of arrays like this:

%hash=(preset=>\@preset, card=>\@card1, intram=>\@ram);
But first of all I'm not sure if that is the best way to do this and then I'm struggling to make this work (I can't figure out what to assign to -choices in the two BrowseEntry widgets).

It would be a huge help for me if someone could tell me the best data structure for this and the -variable and -choices parameters required to make this work (ideally with actual code snippets, based on my example).

If this problem description sounds confusing that's because I am confused! :-)

In reply to data structure problem by perltux

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found