perl Win32:GUI question

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,719
Reaction score
529
Hi perl experts,

I trying out perl menu. This simple code will return the index of a dropdown list. But it always return the index with a comma in front. Any idea what I have done wrong here. Thanks in advance.

Code:
 use Win32::GUI();
 
    $main = Win32::GUI::Window->new(
                -name   => 'Main',
				-pos => [200,200],
                -width  => 500,
                -height => 500,
                -text => 'Select Date',
        );
$main->AddCombobox(     
        -name   => "combo_box1",
        -width  => 120,
        -height => 110,
        -pos => [5,160],
        -dropdownlist=> 0,
        );
$main->combo_box1->InsertItem("One");
$main->combo_box1->InsertItem("Two");
$main->combo_box1->InsertItem("Three");
$main->combo_box1->InsertItem("Four");
$main->combo_box1->InsertItem("Five");

$main->AddButton(
	-name => "Button1",
	-text => 'OK',
	-width => 25,
	-height =>20,
	-pos => [70,100],
	);

sub Button1_Click { 
        my $ListSelection = $main->combo_box1->SelectedItem(); 
        print ",$ListSelection\n"; 
} 
	
    $main->Show();
    Win32::GUI::Dialog();

    sub Main_Terminate {
        -1;
}
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top