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

I am creating a combobox with the following code and would like to set the initial text to be blue. I figured that the -text option would do it but it doesn't. Could anyone tell me what I am missing? Thanks, boat73
$box = $main->AddCombobox( -name => "blue", -left => 20, -top => 35, -width => 600, -height => 500, -style => WS_VSCROLL | WS_VISIBLE | 3 | WS_NOTIFY, ); $Schedtask_combo1->Add("Yellow", "Blue", "Green", "Red");

Replies are listed 'Best First'.
Re: Setting initial value of a Win32::GUI Combobox
by ikegami (Patriarch) on Sep 15, 2004 at 19:40 UTC

    Isn't it just calling ->Select?

    $Schedtask_combo1 = $main->AddCombobox( -name => "blue", -left => 20, -top => 35, -width => 600, -height => 500, -style => WS_VSCROLL | WS_VISIBLE | 3 | WS_NOTIFY, ); $Schedtask_combo1->Add("Yellow", "Blue", "Green", "Red"); $Schedtask_combo1->Select($Schedtask_combo1->FindString("Blue")); # or: $Schedtask_combo1->Select(1);
      Yes it is, can't believe I missed that. Thanks