cormanaz has asked for the wisdom of the Perl Monks concerning the following question:

Good day Monks. I am trying to put a Combobox on a Win32::GUI window. As far as I can tell from the docs I've done it right, but when I run the code below I get a window with nothing in it. What am I doing wrong? TIA.....Steve
use strict; use Win32::GUI; my $main = Win32::GUI::Window->new( -name => 'Main', -width => 600, -height => 500 ); my $box = $main->AddCombobox( -name => "testbox" ); my $result = $box->InsertItem("test item"); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { -1; }

Replies are listed 'Best First'.
Re: Win32::GUI Combobox problems
by jplindstrom (Monsignor) on Aug 29, 2004 at 22:25 UTC
    The AddComboBox line is missing -left, -top, -width and -height options, so I guess you actually have a ComboBox there with no size.

    /J

Re: Win32::GUI Combobox problems
by doowah2004 (Monk) on Aug 30, 2004 at 12:48 UTC
    You might want to add the 'style' tag, I think the win32::gui wants to know what kind of combobox it is. Try the code below:

    $box = $main->AddCombobox( -name => "testbox", -left => 20, -top => 35, -width => 600, -height => 500, -style => WS_VSCROLL | WS_VISIBLE | 3 | WS_NOTIFY, );

    I think the WS_VISIBLE will be the key to your success.