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


Salutations Monks,

i am working with Win32::GUI, and i create a label using AddLabel
$lable = $main->AddLabel( -text => 'temp', -name => 'label_temp', -top => '78', -left => '10', -font => $t_font, -background => [255,255,255], -foreground => [0,0,0],)
and once the label is created, i call the Win32::GUI::Dialog(); but i want to change what the label says after i call the Win32::GUI::Dialog();, but when i do
$label->Change(-text => "something else");
nothing happens, but if i put the change before the Win32::GUI::Dialog(); it works fine... i cant find alot of documentation in detail about it, but i was wondering if there was a -textvariable like in Tk... thanks monks

edited: Mon Jan 27 06:55:37 2003 by jeffa - title change (was: Win32::GUI)

Replies are listed 'Best First'.
Re: Win32::GUI::Dialog label
by jplindstrom (Monsignor) on Jan 26, 2003 at 23:15 UTC
    Eh, wait a minute...

    Is this what you do?

    $lable = $main->AddLabel( ... ) Win32::GUI::Dialog(); $label->Change(-text => "something else");

    If it is, that's the problem. The Change() call isn't executed until Perl returns from Dialog(), and that doesn't happen until you terminate the main event loop.

    You have to call $label->Text() from within an event handler, like so:

    sub SomeButton_Click { $label->Text("Blah"); return(1); }

    If that's already the case, my apologies.


    /J

      heh, well believe it or not, i was doing that a while ago and it wasnt working, or at least i thought it wasnt working, so i changed it and took it out of the *_Click function, though later i found that my problem was that i didnt reset the array with the my hashes... darn mundane details :)
      thanks alot for the help.
Re: Win32::GUI::Dialog label
by jplindstrom (Monsignor) on Jan 26, 2003 at 22:41 UTC
    $label->Text("And now for something completely different");

    should do it.


    /J

      thanks for the reply, but i tried that and it didnt work. i dont know why it wont update... i was looking for something what would refresh the dialog, but i dont know...

      thanks again