I'm creating a program that will take credit card swipe from a USB swiper or the credit card info can be entered manually. I've got a loop currently to read the credit card data being entered from a swiper and I have some buttons on the bottom of the window that the user can press to bring up fields to enter the credit card info into manually (ie card number, expiration date, etc). The problem is that while I'm looping to look for the credit card swipe I cannot accept the user's mouse click on the buttons. Has anyone every done this before/any ideas as how to do it?
Current code:

#!/usr/bin/perl use strict; use warnings; use diagnostics -verbose; use Win32; use Win32::GUI qw(ES_WANTRETURN WS_VISIBLE WS_VSCROLL ); my ($DOShwnd, $DOShinstance) = Win32::GUI::GetPerlWindow(); #Win32::GUI::Hide($DOShwnd); my $desk = Win32::GUI::GetDesktopWindow(); my $dw = Win32::GUI::Width($desk); my $dh = Win32::GUI::Height($desk); use vars qw/$window $status_bar $button1 $button2 $button3 $card_field $sale_field $event_field $card_number_label $option_flag/; $window = Win32::GUI::Window->new( -name => 'main', -text => "Credit Card Authorization", -pos => [170,130], -size => [625,450], -helpbox => 0, -resizable => 0, -maximizebox => 0, ); my $transaction_info = read_psin(); my @transaction_info = @{$transaction_info}; my $card_type = $transaction_info[0]; my $sale_amount = $transaction_info[1]; $status_bar = $window->AddStatusBar( -name => 'status_bar', -text => '', ); $window->Change( -onMouseMove => sub { $status_bar->Text(''); }, ); $button1 = $window->AddButton( -name => 'manual_dial', -text => '1', -size => [60,25], -pos => [120,355], -onMouseMove => sub { $status_bar->Text('Manual card entry with dia +l-out for approval'); }, ); $button2 = $window->AddButton( -name => 'swipe_phone', -text => '2', -size => [60,25], -pos => [270,355], -onMouseMove => sub { $status_bar->Text('Swipe card entry with phon +e call for an approval'); }, ); $button3 = $window->AddButton( -name => 'manual_phone', -text => '3', -size => [60,25], -pos => [420,355], -onMouseMove => sub { $status_bar->Text('Manual card entry with pho +ne call for an approval'); }, ); $window->AddLabel( -name => 'header', -text => 'Credit Card Authorization', -pos => [160,10], ); $window->AddLabel( -name => 'card_type', -text => 'Card Type:', -pos => [20,40], ); $window->AddLabel( -name => 'amount', -text => 'Sale Amount:', -pos => [20,80], ); $card_field = $window->AddTextfield ( -name => 'card_field', -text => $card_type, -size => [180,20], -pos => [90,39], -readonly => 1, ); $sale_field = $window->AddTextfield( -name => 'sale_field', -text => $sale_amount, -size => [180,20], -pos => [90,79], -readonly => 1, ); $event_field = $window->AddTextfield( -name => 'event_field', -size => [360,180], -pos => [120,160], -readonly => 0, -multiline => 1, ); my $card_input = $window->AddTextfield( -name => 'card_input', -size => [480,40], -pos => [90,119], -multiline => 1, -visible => 0, ); $card_number_label = $window->AddLabel( -name => 'card_number_label', -text => 'Card Number: ', -pos => [280,40&], -visible => 0, ); $window->Show(); $window->DoEvents(); $event_field->Append("Initializing modem... "); init_modem(); $event_field->Append("initialized\n"); $card_input->SetFocus(); $event_field->Append("Please swipe card... "); $window->Show(); $window->DoEvents(); my $input1 = $card_input->GetLine(0); my $input2 = $card_input->GetLine(1); while ($card_input->GetLine(1) !~ /\?$/) { #swipe ends second line wi +th a question mark $card_input->SetFocus(); $input1 = $card_input->GetLine(0); $input2 = $card_input->GetLine(1); $window->DoEvents(); # Win32::GUI::Dialog(); ####working here to take in the cl +ick event#### } $event_field->Append("swiped\n"); print "\$input1: $input1\n"; print "\$input2: $input2\n"; my $cc_number; if ($input1 =~ /^\%B(\d{16})/i) { $cc_number = $1; } my $exp_dt; if ($input2 =~ /\=(\d{2})(\d{2})(.*)/) { $exp_dt = $2 . $1; } sleep 1; $event_field->Append("Connecting... ");

In reply to Win32 GUI Input or Event by perldiverx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.