Khoa Doan wrote:
>Does anyone have a sample source that does the similar functions below or
>can give me some hints for my GUI application following:
>
> . Display a window with an input like a text box for operator user
>interface
> . Pass an information (e.g. serial number) from the input box of the
>window to my executable
>               application without click on OK button or something likes
>that.  What I meant here is
>               operator just types an information into the input box and
hit
>enter, then it will automatically
>               do the next step without creating an OK button to
acknowledge
>it.
> . After an information is entered in the input box, it clears the
>input box.

you can still create an OK button with the -default => 1 option, this
way pressing enter in the textfield will be the same as pressing the button.
you have to create a DialogBox for this. sample code (not tested):

$W = new Win32::GUI::DialogBox(
    -name => "Window",
    -title => "Sample application",
    -left => 100,
    -top => 100,
    -width => 200,
    -height => 200,
);

$W->AddTextfield(
    -name => "Info",
    -left => 10,
    -top => 10,
    -width => 150,
    -height => 22,
    -prompt => [ 50, "Info:" ],
    -tabstop => 1,
);

$W->AddButton(
    -name => "OK",
    -left => 150,
    -top => 150,
    -text => "&Enter",
    -tabstop => 1,
    -default => 1,
    -ok => 1,
);

$W->Show();
$W->Info->SetFocus();
Win32::GUI::Dialog();

sub Window_Terminate {
    return -1;
}

sub OK_Click {
    my $info = $W->Info->Text;
    system("$EXECUTABLE $info");
    $W->Info->Text("");
    $W->SetFocus();
}

__END__
# Aldo Calpini
print sort {$_{$a} cmp $_{$b}} values %{{split undef,
"xritajbugne fahokem csuctawer jhdtlrnpqloevkshpr"}};




Reply via email to