What you need is

sub Combo_Anonymous
{
    $ComboText = $Main->Combo->Text () if $_[0] == 6;
}

The way it is coded in GUI.xs, Perl fires the _Change event for
CBN_SELCHANGE and the _Anonymous event for all other notification messages.
You can pick either CBN_EDITCHANGE (5) or CBN_EDITUPDATE (6) to catch the
new text. Note you will get this event whenever "the user has taken an
action that may have altered the text in the edit control" - says MSDN. So,
you may not want to have a lengthy action going on inside the _Anonymous
sub.

Note that, in the _Change event, $Main->Combo->Text() still shows the
contents of the edit control before it is replaced by the selected line from
the listbox. You need to do
sub Combo_Change
{
    $ComboText = $Main->Combo->GetString($Main->Combo->SelectedItem());
}
to have your variable reflect the current contents.

Hope that helps.
Have fun
Harald

-----Original Message-----
From: [EMAIL PROTECTED]
To: perl-win32-gui-users@lists.sourceforge.net
Sent: 07.04.01 19:29
Subject: [perl-win32-gui-users] Combobox/Textfield

I've seen some programs that have a combination Combobox/Textfield.  
So you can either enter text or choose text from the dropdown box.  
When I tried to do this with Win32::GUI, I can type in that space, 
but the program doesn't catch it, and instead gives me whatever was 
selected last.

What I want to do is take whatever text the user enters and add it to 
the Combobox, storing the ten (or so) last strings, so that if they 
want to reenter some text they had previously entered, they won't 
have to retype it.  I could have a Combobox below the Textfield, but 
it looks better to have just one control there.

Any suggestions?

_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

Reply via email to