I'm trying to write a program utilizing win32::Gui.At one point I Psuedocoded the following:
tfTapeName_Click (Type:Event){ Read text from textfield_Tapename; QueryDB (Tapename) If Tapename isn't in the Database then GetMFGDate() from user ELSE Tapename Is in Database Get MFGDATE() from QueryDB(Tapename) If MFGDATE too old then GetMFGDATE() from user until user acknowledges over-ride or enters a good MFGDATE GetDestination() from Textfield_Destination Until Destination is entered and is valid per TapePolicy GetDestination() from User Write Tapename, MFGDATE, Destination, Current time and date to Listview_Entered_Data. }
So I went my merry way to implement this and started setting up a dialog box and then realized 'hey, wait a sec how do I write a function that handles an event but is called? I looked through the Win32::Gui examples but I didn't see anything.

The goal here is

$somevariable = Dialogx();

Where Dialogx()creates a new dialog window asking for the relevant information and then returns the information heretofore placed in the dialog's textfield and transmitted by its ok button. The problem being that all user input is interpreted through events that occur outside the the sub and not neatly available like $somevariable = <STDIN> is. Can I do this with win32::gui? I could only think of how to do this if I used global variables and took that as a sign I may be off course here. Is there a better approach? I think I am getting hung up on my procedural based experience and maybe not seeing how to write this properly.

Pointers to relevant reference material, tips, code, examples eagerly sought.

Thanks, Talwyn


In reply to win32::Gui -- Paradigm problem...How do you get info back from a dialog? by talwyn

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.