Hi,
There are 3 different types of combobox - see MSDN for details:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/comboboxes/comboboxes.asp
Two of the types include the selected item in an edit control, whose
default behaviour is to use home/end to move to the beginning/end of the
text. The third has the behaviour you desire, but not the look that you
demonstrated with you script. It would be possible to adapt either of
the first two types to do what you want as well, but this is certainly
not trivial, and would deviate from the standard 'user experience'.
Here's a script demonstrating all three types:
#!perl -w
use strict;
use warnings;
use Win32::GUI();
my $Win = Win32::GUI::DialogBox->new(
-title => "ComboBox Types",
-size => [350,200],
);
# Standard: Edit control + listbox
$Win->AddCombobox(
-name => 'Markets1',
-pos => [10,10],
-size => [100,100],
-vscroll => 1,
-tabstop => 1,
);
# Drop down: Edit control + drop-down
$Win->AddCombobox(
-name => 'Markets2',
-pos => [120,10],
-size => [100,100],
-vscroll => 1,
-tabstop => 1,
-dropdown => 1,
);
# Drop down list: Static control + drop-down
$Win->AddCombobox(
-name => 'Markets3',
-pos => [230,10],
-size => [100,100],
-vscroll => 1,
-tabstop => 1,
-dropdownlist => 1,
);
my @markets = ('Regular', 'Odd lot', 'Deal', 'BER regular', 'Oferte
publice', 'Drepturi de preferinta');
$Win->Markets1->Add(@markets);
$Win->Markets2->Add(@markets);
$Win->Markets3->Add(@markets);
$Win->Show();
Win32::GUI::Dialog();
exit(0);
__END__
Regards,
Rob.
Octavian Rasnita wrote:
Hi,
I have created a combo box using the code below, but I cannot move the
cursor to select the first or the last element from the combo box using the
home and end keys.
What can I do to be able to do this?
Thank you.
$Win->AddCombobox(
-name => 'Markets',
-left => 60,
-top => 10,
-width => 120,
-height => 22,
-tabstop => 1,
);
my @markets = ('Regular', 'Odd lot', 'Deal', 'BER regular', 'Oferte
publice', 'Drepturi de preferinta');
$Win->Markets->Add(@markets);
Teddy
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs