This is not a GUI issue per se, as it is the fact that your routine runs synchronous, in the main thread of the application. To remove this lag (and the delayed drawing of the window) you will need to do some looking through the mail archives and find how to write this into a separate thread.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Nürnberger Sent: Thursday, July 26, 2007 7:21 AM To: perl-win32-gui-users@lists.sourceforge.net Subject: [perl-win32-gui-users] Why is my GUI hanging? Hi everyone, I tried to create a little GUI for a program which I wrote a while ago. It's only a little link filter. I have to give him an URL, he parses the website for given regular expressions and gives back a HTML file with all the links in it. Now the problem is that if i enter the URL and click on the Button to proceed, the program hangs for about 30 seconds before it goes on. Everything works fine. Only this "lag" is very disappointing. I can't find my mistake... If I do the same on the console, everything works instantly without hanging. I would be glad if someone could help me out. :) Here's the code: use LWP::UserAgent; use HTTP::Cookies::Mozilla; use Win32::GUI(); # Use of the Firefox Cookie file # For German Systems: Change the Docume~1 to Dokume~1 # I'm working on a better solution for this $kekse = HTTP::Cookies::Mozilla->new( 'file' => glob("C:/Docume~1/$ENV{'USERNAME'}/Anwendungsdaten/Mozilla/Firefox/Profiles/ *.default/cookies.txt")); # Creation of the LWP Useragent with the Firefox Cookie file $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0'); $ua->cookie_jar($kekse); # Creation of the GUI $main = Win32::GUI::Window->new( -name => 'Main', -width => $width = 295, -height => $height = 161, -maximizebox => 0, -resizable => 0, -text => 'Link Filter', ); $lblURL = $main->AddLabel( -name => 'lblURL', -width => 100, -height => 17, -align => 'left', -left => 4, -top => 4, -text => 'Bitte URL eingeben:', ); $tfURL = $main->AddTextfield( -name => 'tfURL', -width => 281, -height => 77, -align => 'left', -left => 4, -top => 20, -multiline => 1, ); $btGet = $main->AddButton( -name => 'btGet', -width => 279, -height => 33, -left => 5, -top => 100, -text => 'Get Them!', ); $desk = Win32::GUI::GetDesktopWindow(); $deskwidth = Win32::GUI::Width($desk); $deskheight = Win32::GUI::Height($desk); $deskx = ($deskwidth - $width) / 2; $desky = ($deskheight - $height) / 2; $main->Move($deskx, $desky); $main->Show(); Win32::GUI::Dialog(); sub Main_Terminate { return -1; } sub btGet_Click { # Copy the entered URL into a usable variable $url = $tfURL->Text; return -1; } # Get the content of the Website and save it into a temporary HTML file $ua->get($url, ':content_file' => 'temp.html'); open(EINGABE, "temp.html") || die("Fehler: Datei temp.html konnte nicht gefunden werden."); open(AUSGABE, ">links.html") || die("Fehler: konnte Datei rs.html nicht erstellen."); # Filter the links from the temporary file and write them into a new HTML file while($zeile = <EINGABE>) { if ($zeile =~ m/ENTER YOUR REGEXP HERE/) { $zeile =~ s/ENTER YOUR REGEXP HERE/AND HERE/; print AUSGABE "<a href=\"" . $zeile . "\">" . $zeile . "</a>" . "<br>"; } } close(EINGABE); close(AUSGABE); # Delete temporary file unlink "temp.html"; # Open the file which holds the filtered links `links.html`; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.10.20/919 - Release Date: 7/26/2007 9:56 AM