RE: [perl-win32-gui-users] Win32::GUI::Scintilla
Sorry for my previous message because it was sent from a non-subscribed email address, and only the admin probably received it. Here it is again: I am using Perl 5.8.8 and I have installed Win::GUI::Scintilla using ppm: Version: 1.7 Author: ROCHER Laurent ( [EMAIL PROTECTED]) I am using Perl 5.8.8 and not Perl 5.6. Is this version of scintilla working only with Perl 5.6? Basically, yes, that version only works with 5.6. The reason is that the internals of win32-gui have changed over time, which causes a fatal crash in 5.8 but not in 5.6. Is there a Win32::GUI::Scintilla that can work with Perl 5.8.8? Yes, version 1.8 - you'll have to build it from the sources (via VC or mingw) - if you can wait a little longer a new build should be round the corner. Cheers, jez.
RE: [perl-win32-gui-users] Need an example, please.
Hey Kevin You should use the Win32::GUI::Dialog() call instead of calling sleep and DoEvents explicitly.. You do a "sleep" for each line in the file, so it's no surprise it takes forever to read... This will also keep your program running after it exits the last loop. To read the file you can use a timer: $main->AddTimer('ReadFile',1000); sub ReadFile_Timer{ open INFILE, "<$infile" or die "open infile error: $! File: $infile"; my $output; foreach my $line () { chop $line; $output.="$line\r\n"; } $main->Textfield->Change(-text => $output); } - Nikolaj > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Kevin L. Gross > Sent: 31. maj 2006 02:32 > To: perl-win32-gui-users@lists.sourceforge.net > Cc: darrik > Subject: Re: [perl-win32-gui-users] Need an example, please. > > > Thanks for the suggestion. I tried it and it works...sort of. > > > First off, it is painfully slow. Takes a couple of minutes > for a small file (2K) to display, one line at a time. This > can't be normal for Perl on Windows can it? > > Second, no scroll box, even tho the -multiline and > -autovscroll parameters are set to 1. > > Third, the GUI app disappears completely after the last line > is printed. How do you keep the window (and/or DOS command > window) up and displayed? > > Isn't there a better way to flow text into a scroll-bar field > or window or dialog or something? > > -Kevin > > > use strict; > use Win32::GUI; > > my $main = Win32::GUI::Window->new( > -name=> "Main", > -title => "Win32-GUI: Doevents-Demo", > -left=> 100, > -top => 100, > -width => 600, > -height => 800, > ); > > sub Main_Terminate() { > print "Main window terminated\n"; > return -1; > } > > my $textfield = $main->AddTextfield( > -name => "Textfield", > -text => "have fun and more", > -left => 75, > -top=> 150, > -width => 200, > -height => 600, > -readonly => 1, > -multiline => 1, > -autovscroll => 1 > ); > > $main->Show(); > > my $output; # possibly declare this globally further up... > my $infile="/Documents and > Settings/Kevin/Desktop/Stuff/Perl/samplegui2.pl"; > $output.="Processing infile $infile..."; > $textfield->Text($output); > open INFILE, "<$infile" or die "open infile error: $! File: > $infile"; > foreach my $line () { > chop $line; > $output.="$line\r\n"; > #$textfield->Text($output); > #print "$line\n"; > >Win32::GUI::DoEvents() >= 0 or die "Window was closed > during processing"; >sleep 1; #body of the loop... > } > > $output.="completed"; > $textfield->Text($output); > Win32::GUI::DoEvents(); > sleep 1;#program continues... > > > > --- > All the advantages of Linux Managed Hosting--Without the Cost > and Risk! > Fully trained technicians. The highest number of Red Hat > certifications in the hosting industry. Fanatical Support. > Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&; > dat=121642 > ___ > 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/ >
Re: [perl-win32-gui-users] Win32::GUI::Scintilla
From: "Jeremy White" <[EMAIL PROTECTED]> > >Is there a Win32::GUI::Scintilla that can work with Perl 5.8.8? > > Yes, version 1.8 - you'll have to build it from the sources (via VC or > mingw) - if you can wait a little longer a new build should be round the > corner. Ok, thanks. I can try to compile it even though I am not a C programmer. Can you please tell me where can I download the source code from? Teddy
Re: [perl-win32-gui-users] Win32::GUI::Scintilla
Ok, thanks. I can try to compile it even though I am not a C programmer. Can you please tell me where can I download the source code from? http://sourceforge.net/projects/perl-win32-gui Cheers, jez.
Re: [win32-gui] Re: [perl-win32-gui-users] Need an example, please.
Kevin L. Gross wrote: First off, it is painfully slow. Takes a couple of minutes for a small file (2K) to display, one line at a time. This can't be normal for Perl on Windows can it? That's down to you sleep()ing for 1 second for every line of your file - that's bound to be slow! Second, no scroll box, even tho the -multiline and -autovscroll parameters are set to 1. You need -vscroll Third, the GUI app disappears completely after the last line is printed. How do you keep the window (and/or DOS command window) up and displayed? Win32::GUI::Dialog() Isn't there a better way to flow text into a scroll-bar field or window or dialog or something? Try this. Regards, Rob. -- Robert May Win32::GUI, a perl extension for native Win32 applications http://perl-win32-gui.sourceforge.net/ #!perl -w use strict; use warnings; use Win32::GUI qw(WS_CLIPCHILDREN); my $mw = Win32::GUI::Window->new( -title=> "Read File line by line", -pos => [100,100], -size => [400,300], -onResize => \&mwResize, -addstyle => WS_CLIPCHILDREN, # prevent some flickering on resize ); $mw->AddTextfield( -name => "TF", -size => [$mw->ScaleWidth(), $mw->ScaleHeight()-30], -readonly => 1, -background => 0xEE, -multiline => 1, -vscroll=> 1 ); $mw->AddButton( -name=> 'BT', -text=> 'Load file', -pos => [$mw->ScaleWidth()-65, $mw->ScaleHeight()-25], -onClick => \&load_file, ); $mw->Show(); Win32::GUI::Dialog(); $mw->Hide(); exit(0); sub mwResize { my $win = shift; my ($width, $height) = ($win->GetClientRect())[2..3]; # Resize edit control $win->TF->Resize($width, $height-30); # re-position button $win->BT->Move($width-65, $height-25); return 0; } sub load_file { my $retval = 0; my $file = $0; # This perl script open my $fh, '<', $file or die "Failed to open $file for reading"; while (<$fh>) { chomp $_; $_ .= "\r\n"; # Ensure win32 line endings # Add text to end of edit control $mw->TF->SetSel(-1,-1); # set selection point to the end # of the edit control $mw->TF->ReplaceSel($_); # replace selection with # additional text # DoEvents: draws the added text, and allows gui interaction # in case this takes a long time $retval = Win32::GUI::DoEvents(); # returns -1 if user # terminates window last if $retval == -1; # user terminated window, # abort from while{} loop } close $fh; return $retval; # return -1 to exit Win32::GUI::Dialog() } __END__
[perl-win32-gui-users] Internal Dragging
Has anyone implemented TreeViews or Listboxes with internal dragging, i.e., to move nodes/items within the control? The mouse events are (or at least should be) trivial, but the drag image is another matter. A simple line indicating the new position of the item/node would be sufficient.