Return values from a sub listbox to a main panel 
Author Message
 Return values from a sub listbox to a main panel

Can someone tell me how to this please?
For example, if you go to the "widget"
demo in the install directory and start up
the demo ... you get the facing panel
"Perl/Tk Widget Denonstrations"

If you then click on
"Listboxes"
 1. 50 States
    that will take you to the list of states

That will alow you to select the state you
are interested in. How do you send this
state back to the main panel?

Thanks,

Jim Jan 08, 2001

Sent via Deja.com
http://www.*-*-*.com/



Sat, 28 Jun 2003 00:28:56 GMT  
 Return values from a sub listbox to a main panel

Quote:

> Can someone tell me how to this please?
> For example, if you go to the "widget"
> demo in the install directory and start up
> the demo ... you get the facing panel
> "Perl/Tk Widget Denonstrations"

> If you then click on
> "Listboxes"
>  1. 50 States
>     that will take you to the list of states

> That will alow you to select the state you
> are interested in. How do you send this
> state back to the main panel?

You must create your own binding for this. Usually it is a double click.

$listbox->bind('<Double-B1>',sub{$selection=$listbox->get('active');});

Now you can do something with the value in $selection.

Go to the next listbox widget demo called 'Colors' to see how this is
done.

Jack

Sent via Deja.com
http://www.deja.com/



Sat, 28 Jun 2003 03:55:36 GMT  
 Return values from a sub listbox to a main panel

Quote:
> Can someone tell me how to this please?
> For example, if you go to the "widget"
> demo in the install directory and start up
> the demo ... you get the facing panel
> "Perl/Tk Widget Denonstrations"

> If you then click on
> "Listboxes"
>  1. 50 States
>     that will take you to the list of states

> That will alow you to select the state you
> are interested in. How do you send this
> state back to the main panel?

The way I like to get values from a Listbox is:





As Jack wrote, you may also bind double click to code that
extracts the active element.

--
Marc Dashevsky  (remove "_" from address to reply by e-mail)



Sat, 28 Jun 2003 10:09:40 GMT  
 Return values from a sub listbox to a main panel


Quote:

> The way I like to get values from a Listbox is:






Yes! This is the best way...as it will handle multiple selections.
Actually, I only have one program which uses a Listbox...and indeed,
Marc's method is what I used.

I guess I must have been on the right track at some point in the past.
:-)

Jack

Sent via Deja.com
http://www.deja.com/



Sun, 29 Jun 2003 12:29:58 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Flexible sub param/return value handling?

2. problem with a sub-routine returning values

3. returning values out of a recursed sub

4. return values without sub

5. Sub opens window and returns value

6. adding percent value to main value

7. Filehandles within a sub, passed ot main

8. return from main

9. PERLFUNC: values - return a list of the values in a hash

10. PERLFUNC: values - return a list of the values in a hash

11. main:: being prepended to values

12. What does main' in sub main'routine do?

 

 
Powered by phpBB® Forum Software