Kieron, I'm not sure that this is exactly what you're looking for, but it may point you in the right direction. It doesn't trigger on a change via the drop-down list, but it does capture keystrokes:
-start- #! perl -w use Win32::GUI qw(CBN_EDITCHANGE WM_COMMAND); use strict; my $x = Win32'GUI'Window->new('-size', [100, 100], '-pos', [0,0], '-visible', 1); my $y = $x->AddCombobox('-pos', [10, 10], '-size', [50, 200], '-dropdown', 1); $y->Add(1, 2); $y->Select(0); $y->Hook(CBN_EDITCHANGE, sub { my ($hObject, $wParam, $lParam, $iType, $iMsgCode) = @_; return 1 unless $iType == WM_COMMAND; print "Change: ".$y->Text."\n"; 1; } ); Win32'GUI'Dialog; -end- Cheers, Glenn -----Original Message----- From: Perl Rob [mailto:perl...@comcast.net] Sent: 12 December 2008 01:06 To: kieren.dun...@haddonhouse.co.uk Cc: perl-win32-gui-users@lists.sourceforge.net Subject: Re: [perl-win32-gui-users] Perl-Win32-GUI-Users Digest, Vol 30,Issue 2 Hi Kieron, To find out what has been selected, use the GetCurSel() method to get the index number of the currently selected item, then use the GetString() method to get the text of the item at that index: my $change = sub() { my $num = $y->GetCurSel; my $text = $y->GetString($num); print "You just selected $text\n"; }; As for your first question, I don't think a combobox listens for keyboard events by default (they're certainly not mentioned in the "Events" section of the API). I tried using the Hook() method with the WM_KEYUP event but that didn't work. Perhaps someone else knows. Regards, Rob ------------------------------ Message: 4 Date: Tue, 9 Dec 2008 16:30:37 -0000 From: "Kieren Dunbar" <kieren.dun...@haddonhouse.co.uk> Subject: [perl-win32-gui-users] Combobox problems To: <perl-win32-gui-users@lists.sourceforge.net> Message-ID: <53d8a58004a3594d9324cb66e7d1c3e9ca6...@hhlive.hh.local> Content-Type: text/plain; charset="us-ascii" Hi All I have tried to use a combobox to do something, but I have had two problems. 1. I don't know what events are triggered if I type into the text box. It doesn't trigger obvious possibilities such as KeyUp, so I don't know what to look for. 2. If I trigger the Change trigger, box->Text contains the previous selection rather than the current one. How can I find out what the user has selected this time? I experienced this problem with ActiveState Perl 5.8.8 and Win32::GUI version 1.0.6. The source I used is as below. Could someone please suggest what I should do? Thank you. Kieron -start- my $x = Win32'GUI'Window->new('-size', [100, 100], '-pos', [0,0], '-visible', 1); my $y = $x->AddCombobox('-pos', [10, 10], '-size', [50, 200], '-dropdown', 1); $y->Add(1, 2); $y->Select(0); my $change = sub() {print $y->Text."\n"}; $y->Change('-onChange', $change); $y->Change('-onKeyUp', $change); Win32'GUI'Dialog; -end- ---------------------------------------------------------------------------- -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/