I'm having problems with grayed out items in combo boxes and was wondering
if anyone had come across this problem and/or had a solution.
If I put a combo box on my main window then all is fine - the items appear
and they are not grayed out. However, put them on a modal dialog box and the
items are grayed - even though I'm using the same options to create the
combo.
The code below exhibits this problem.
Thanks in advance for any assistance.
Regards
Martin
============================================================================
==============
use Win32::GUI;
use strict;
my $screen_width = Win32::GUI::GetSystemMetrics(0);
my $screen_height = Win32::GUI::GetSystemMetrics(1);
my $minwidth = 620;
my $minheight = 255;
my $MixDlg;
my $DlgCombo;
my $MainCombo;
my $MainWindow = new Win32::GUI::Window(
-name => "MainWindow",
-top => ($screen_height - $minheight)/2,
-left => ($screen_width - $minwidth)/2,
-width => $minwidth,
-height => $minheight,
-minsize=> [$minwidth,$minheight],
-title => "Combo Test Window",
-onMouseRightDown => \&mouseRightDown,
);
$MainWindow->Show();
$MainCombo = $MainWindow->AddCombobox(
-name => "MainCombo",
-tabstop => 1,
-addstyle => WS_VISIBLE | 2 | Win32::GUI::constant("WS_NOTIFY", 0),
-left => 10,
-top => 10,
-width => 110,
-height => 160,
);
$MainCombo->InsertItem ("Item one - main window");
$MainCombo->InsertItem ("Item two - main window");
$MainCombo->Select(0);
Win32::GUI::Dialog();
exit;
sub mouseRightDown {
print STDERR "Mouse click\n";
my $xDlgSize = 310;
my $yDlgSize = 180;
$MixDlg = new Win32::GUI::DialogBox (
-name => "MixOptionsDlg",
-title => "Mix Options",
-pos => [ 10, 10 ],
-size => [ $xDlgSize, $yDlgSize ],
);
$DlgCombo = $MixDlg->AddCombobox(
-name => "DlgCombo",
-tabstop => 1,
-addstyle => WS_VISIBLE | 2 | Win32::GUI::constant("WS_NOTIFY", 0),
-left => 10,
-top => 10,
-width => 110,
-height => 160,
);
$DlgCombo->InsertItem ("Item one");
$DlgCombo->InsertItem ("Item two");
$DlgCombo->Select(0);
$MixDlg -> DoModal (1);
}