From: Piske, H. <Har...@bo...> - 2001-06-26 18:20:16
|
I don't quite see where your problem is ... do you want to know HOW to update your window or WHEN?=20 As for the how, your $sb->Text("whatever"); should work fine anytime. = As for the when, maybe you are looking for a timer so that you can update the status bar every other second or so. No offence, but maybe you just need to grasp the messaging concept of windows? I mean, when does which part of the script run and pass = control where? That can admittedly be confusing. Forgive me, if that was not = what you wanted to know: Your Win32::GUI::Dialog(); call (btw: where IS your Dialog() call??) = passes control to the GUI, which loops for events and calls the event handlers (e.g. your Button_Click sub) until ANY of these subs returns a negative number (not just Main_Terminate). A lot of those event handlers do some default stuff, like redraw all the controls of your window when it = becomes visible. If you have an event handler that runs forever (maybe in a = loop of your own that processes a giant file line by line), then the = $sb->Text("20% done"); call does alter the status bars text property, but the redraw message, which writes the new text onto the window for you to see never = gets called, because your program is inside this long running sub and not = passing control back to the GUI Dialog loop. In that case, simply call Win32::GUI::DoEvents(); inside your script and the outstanding events = will be acted upon. Again, sorry if this is not what you asked for. Have fun, Harald > -----Original Message----- > From: Louis Bohm [mailto:lb...@li...] > Sent: Tuesday, June 26, 2001 10:53 > To: per...@li... > Subject: [perl-win32-gui-users] Updating a window. >=20 >=20 > I am sure this is a really stupid question. But how do I=20 > update things in=20 > the window I create WITHOUT human intervention. >=20 > Here is what I have for a script: > use Win32::GUI; > $main =3D Win32::GUI::Window->new( > -name =3D> 'Main', > -width =3D> 100, > -height =3D> 100, > -text =3D> 'Louis', > ); > $main->AddLabel( > -name =3D> "Louis", > -text =3D> "Hello World 1" > ); > $sb=3D$main->AddStatusBar( > -name =3D> "Status" > ); > $sb->Text("Some data"); > $main->Show(); > Win32::GUI::Window(); >=20 > sub Main_Terminate { > -1; > } >=20 > sub Main_Resize { > $sb->Move(0, $main->ScaleHeight - $sb->Height); > $sb->Resize($main->ScaleWidth, $sb->Height); > } >=20 >=20 > Now what I would like to do it periodically update the text=20 > in the status=20 > bar with out the user getting involved. >=20 > Thanks, > Louis >=20 > -- > = =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 > =A4=B0`=B0Lightbridge, Inc > =A4=B0`=B067 South Bedford St. > =A4=B0`=B0Burlington MA 01832 > =A4=B0`=B0781.359.4795 mailto:lb...@li... > =A4=B0`=B0http://www.lightbridge.com > = =A4=A4=BA=B0`=B0=BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0= =BA=A4=F8,=B8=B8,=F8=A4=BA=B0`=B0=BA=A4=F8=F8=A4=BA=B0`=B0=BA=A4 >=20 >=20 > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >=20 |