Re: Help with Wx::Perl::PubSub
Steve Cookson - gmail <[email protected]> Tue, 19 May 2015 11:21:02 -0300
| Newsgroups | gmane.comp.lang.perl.wxperl |
|---|---|
| Message-ID | <[email protected]> |
Hi François,
On 19/05/15 07:55, RAPPAZ Francois wrote:
> Another question: I would like to have a dropdbox that list usernames and that return a userid when one select a name. Shall I use a Wx::ListBox or Wx::ListCtrl ?
> Can you point me to some codes examples ?
I would use wx::combobox (here:
http://docs.wxwidgets.org/trunk/classwx_combo_box.html). I don't recall
if it has a a client data attribute like listctrl, if not you can always
use an indexed array like this:
@combo_options = ("Andy", "Bob", "Charlie", "Dave", "Edward",
"François"); # User names
@userid = ("a_smith", "r_smith", "c_smith", "d_smith", "e_smith",
"f_rappaz); # User ids
Wx::ComboBox->new($self->{$parent, -1, "", wxDefaultPosition,
wxDefaultSize, \@combo_options, wxCB_DROPDOWN|wxCB_READONLY|wxCB_SORT);
.
.
.
.
$userid_selected=$userid[$combobox->GetSelection()];
There's so much code in cpan -i Wx::Demo for everything. Otherwise
people have put various tutorials on PerlMonks. Here are some other links:
http://wxperl.sourceforge.net/tutorial/tutorial.html
http://learnperl.scratchcomputing.com/tutorials/wxperl/
http://wiki.wxperl.nl/Main_Page
http://www.perlmonks.org/?node_id=112297
http://examples.wxperl.it/
http://www.perl.com/pub/2001/09/12/wxtutorial1.html
http://padre.perlide.org/learning-wxperl-and-wxwidgets.html
Oh and I almost forgot, wxGlade (apt-get install python-wxglade) will
produce wxPerl code for you, although I don't know if it has been
upgraded for 3.0.x. I used it to to build most of my early screens. At
least it will get your syntax right.
Good luck,
Steve.