Q: perl's equivalent to some AutoIT's functions
Hi I have been doing some AutoIT scripting these few days and find it, great. However, I prefer to program on my "native tongue". Here are some questions that I need out of perl that I am doing with Autoit. Is there a Perl equivalent to: AutoIt's PixelGetColor AutoIt's PixelSearch and a DLL call that scans the current displayed screen with a given grahics file. I am not referring to getting pixel color off a static graphics file, but rather the dynamic displayed screen. Thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
TK Listbox problem; need help
Hi, Below is the script I have. 1. Listbox is suppose to have 0-99 lines. working 2. when user clicks on a line, it will highlight the line. working 3. when user clicks on a particular line, script will display the value of that line to STDout. not working. What happens is, it prints the value of the previous click!!! Why? What is wrong? Dan. use strict; use Tk; require Tk::BrowseEntry; require Tk::ROText; my $mw = MainWindow->new( -bg=> "#404040", -borderwidth=> 0); $mw->minsize( 100, 200 ); my $LB = $mw->Scrolled( "Listbox", -bg=> "#C0C0C0", -fg=> '#00', -relief=> 'raised', -scrollbars=> 'e', -cursor=> 'top_left_arrow', )->pack( -side => 'top', -expand => 1, -fill => 'both', ); $LB->bind('', sub { DoThis( $LB->get('active') ); } ); for (my $x=0; $x<100; $x++) { $LB->insert('end',$x); } sub DoThis { my $this = shift; print $this,"\n"; } MainLoop; ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
TK Notebooks on the side
Hi, I am trying to write a TK notebook script: use strict; use Tk; use Tk::NoteBook; my $mw = MainWindow->new(); my $nb = $mw->NoteBook()->pack(-expand => 1, -fill=>'both'); my $p1 = $nb->add('page1', -label=> 'Page 1'); my $p2 = $nb->add('page2', -label=> 'Page 2'); my $p3 = $nb->add('page3', -label=> 'Page 3'); my $p4 = $nb->add('page4', -label=> 'Page 4'); MainLoop; But what I want is to display the tabs/pages on the left side. How? thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Deleting/Removing TK objects
Hi, I would like to know how to remove/delete TK objects/widgets. For example: $frame{x} = $mw->Button( ..); $frame{y} = $mw->Entry(...); . . . How do I delete the Button? How do I delete Entry? Basically, I am writing an app; the mainwindow is filled with button menus. If I click on any of the buttons, it will clear (either delete or hide) the window of buttons and populate the window with other stuffs. Once I am done, it will clear it and go back to mainwindow with buttons. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
TK: button with multiple font sizes
Hi I need a button with a big label and below it, description of the button. I dont know how to make a TK button with multiple font size. If not button, any TK object, clickable, and multiple font size capable. thanks Dan. ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
How to know a closed Socket?
Hi If I opened a socket connection: $web = new IO::Socket::INET( PeerAddr => "192.168.1.1", PeerPort=>80 ); how do I know if $web is still open for read/write? how do i know if 192.168.1.1 is still talking to me? with files, I just do: eof $filehandle; is there a similar function with sockets? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help with Data Structure: array of hash
Hi All, I am having problem with array and Hash data structure. Example is show below: #CODE 1 my @list; my %this; $this{x} = 1; $this{y} = 2; $this{z} = 3; $this{Z} = 4; push @list, %this; My intention above is to have variable @list as an array of hash, ie: $list[0]{x} $list[0]{y} $list[0]{z} $list[0]{Z} or %{$list[0]} The last line does not work according to what I want it to do. And instead, @list now contains: $list[0] = 'x'; $list[1] = 1; $list[2] = 'y'; $list[3] = '2'; . . . I have resorted to: @list[ scalar @list ] = %this; which I find not so "elegant"... What is the "correct" way of writing it anyways? Secondly, is there a way to not use the has variable %this above? ie, something like push @list, {x=>1,y=>2,z=>3,Z=>4}; How should I write it "correctly"? And lastly, as I try to pop it out: %this = pop @list; printf "%d %d %d %d\n", $this{x}, $this{y}, $this{z}, $this{Z}; it wont work. I am getting zeroes/blank on the hashes. Why? How should I write it "correctly" again? Thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
In need to efficiently retrieve HTTP
Hi All Basically, I need to fetch thousands and thousands of small 200~4000 byte files (map files). Opening and closing a socket connection is too slow a process so much so a single file would take as much as 10 seconds! Is there any perl script out there that can be used to efficiently fetch HTTP files? A non-closing script? I sure wanna do Threaded on this one, but my win32 perl does not have thread capability. Or perhaps, is there a win32 API for this purpose and can be called from a perl script? thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help with TK DirTree
Hi I am writing a Perl "File Manager" app using TK and DirTree to navigate the folders. $frame->Scrolled( 'DirTree', -command => [\&ListDir] )->pack( -side => 'right', -expand => 1, -fill => 'x', ); Here is my problem: The above will only list the current Drive. It would not allow me to switch from "C" to "D" or any other drives i have. Is there a way to tell DirTree to list from the root? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
directory listing of "Computer" on win32
Hi All, I am clueless how to do a directory list starting at the very root "Computer" which includes all drives. What I am doing to get a directory tree is this: my $directory = ""; opendir DIR, $directory; my @files = readdir DIR; closedir DIR; But it only start at one drive - not all drives. I am missing out on where to start the initial directory. My main goal is to get all the drives on my computer, so I can do a directory tree on those drives. Thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need Help with Win32::guitest
Hi $id contains the handle to a window that is currently "minimized". I have tried SetActiveWindow($id); SetFocus($id); SetForegroundWindow($id); All did not bring up the window to foreground... What am I doing wrong? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
help intercepting STDIO
Hi I am trying to write a GUI application that will convert videos to another format using a program called FFMPEG. FFMPEG is basically text based apps which displays text "status" to standard output. I would like my application to intercept these strings in real-time and displays it on my very own Tk Window Questions: #1. How do I intercept these strings? #2. How do I call FFMPEG from within a perl script? * Do I use backtick? * Do I use Syscalls? Thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help with TK: scrollable adjustable columns of text
hi I am trying to write a TK application that will display a scrolled text with adjustable columns similar to the PPM's display. currently, what I have researched is using pannedwindow. however this is good for simple labels wherein one side isnt sync to the other. What i need is scrolledtext + adjustable columns. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
preserving Perl installation
Hi In the last 2 months, I need to re-install Windows XP due to a bad HD and file system. Then I bought a new PC.. all in all 3 times I installed Perl + modules. very time consuming. Is there a way to preserve Perl Installation when I move it to another computer? I want to save the Perl folder and copy to another PC's HD.. but this dont work well.. any ideas? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Help: Random Read/Write a binary file
Hi All I have files previously created in binmode. ie, open SFILE, "filename.dat"; binmode SFILE; print SFILE $buffer; close SFILE; Now, I want to Append this file somewhere in the middle. my $i = (-s "filename.dat") / 2; open SFILE, "filename.dat"; binmode SFILE; seek SFILE $i, 0; print SFILE $data; close SFILE; this does not seem to work. How do I properly open a file for random read/write? if I open it with open SFILE, "filename.dat"; seek SFILE $i, 0; It does not append. If I open it with open SFILE, ">>filename.dat"; seek SFILE $i, 0; It keeps appending at the end if I open it with open SFILE, ">>filename.dat"; seek SFILE $i, 0; it writes at that location alright, but first half of data are blank. HELP! :( Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: PerlTK's Photo does not accept bmp format
t;configure( -image => 'image1' ); unlink "_temp.bmp"; } On Wed, Dec 2, 2009 at 12:26 AM, Glenn Linderman wrote: > Hi Dan, > > Any success here? > > I'd suggest using IrfanView for testing, in addition to MSPhotoEdit, > although since BMP is a MS-proprietary format, their software should > understand it, I wouldn't trust MSPhotoEdit to conform to industry standard > formats. > > On approximately 11/23/2009 11:37 PM, came the following characters from > the keyboard of Daniel Burgaud: > >> Hi >> >> Unfortunately, this method was for Linux only.. not for Win32... >> >> Fortunately I managed to dig out the bug. It turns out that the BMP >> produced >> by Win32::Clipboard::GetBitmap is simply not compatible to TK. >> >> The BMP file created by Win32::Clipboard::GetBitmap is not even compatible >> with MSPhotoEdit. So I tried to create a BMP file with MSPhotoEdit and >> that >> file was acceptable to TK. .. >> >> Now I know what to do next... I'll play around this file and see what is >> difference >> it has over Win32::Clipboard::GetBitmap format... >> >> Dan >> >> On Mon, Nov 23, 2009 at 4:19 PM, Glenn Linderman > p...@nevcal.com>> wrote: >> >>On approximately 11/22/2009 11:48 PM, came the following >>characters from the keyboard of Daniel Burgaud: >> >>Hi, >> >>Does TK have image Crop functionality? >> >>The reason why I wanted to use BMP is it's simple format.. >>What I need in my final code is to show in a small "label >>widget" a small portion of the screen >>where the mouse was when ButtonRelease-1 was issued. BMP >>cropping is easy to accomplish >>with perl. >> >> >>The reference I gave (and I'm not much of a Tk user, so just found >>it using Google), seems to talk about how Tk can capture even a >>single widget from the screen... but maybe that only applies to >>things placed there by Tk, maybe you are capturing something from >>another program. Anyway, good luck on achieving your goals. >> >> >>http://www.perlmonks.org/index.pl?node_id=361299 describes one >>way, dunno if it can be ported to Windows or not. >> >> >> >> > -- > Glenn > > “Everyone is entitled to their own opinion, but not their own facts. In > turn, everyone is entitled to their own opinions of the facts, but not their > own facts based on their opinions.” -- Guy Rocha, retiring NV state > archivist > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: PerlTK's Photo does not accept bmp format
Hi Unfortunately, this method was for Linux only.. not for Win32... Fortunately I managed to dig out the bug. It turns out that the BMP produced by Win32::Clipboard::GetBitmap is simply not compatible to TK. The BMP file created by Win32::Clipboard::GetBitmap is not even compatible with MSPhotoEdit. So I tried to create a BMP file with MSPhotoEdit and that file was acceptable to TK. .. Now I know what to do next... I'll play around this file and see what is difference it has over Win32::Clipboard::GetBitmap format... Dan On Mon, Nov 23, 2009 at 4:19 PM, Glenn Linderman wrote: > On approximately 11/22/2009 11:48 PM, came the following characters from > the keyboard of Daniel Burgaud: > > Hi, >> >> Does TK have image Crop functionality? >> >> The reason why I wanted to use BMP is it's simple format.. >> What I need in my final code is to show in a small "label widget" a small >> portion of the screen >> where the mouse was when ButtonRelease-1 was issued. BMP cropping is easy >> to accomplish >> with perl. >> > > The reference I gave (and I'm not much of a Tk user, so just found it using > Google), seems to talk about how Tk can capture even a single widget from > the screen... but maybe that only applies to things placed there by Tk, > maybe you are capturing something from another program. Anyway, good luck > on achieving your goals. > > > http://www.perlmonks.org/index.pl?node_id=361299 describes one >>way, dunno if it can be ported to Windows or not. >> >> >> ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: PerlTK's Photo does not accept bmp format
Hi, Does TK have image Crop functionality? The reason why I wanted to use BMP is it's simple format.. What I need in my final code is to show in a small "label widget" a small portion of the screen where the mouse was when ButtonRelease-1 was issued. BMP cropping is easy to accomplish with perl. Nonetheless, I will try your recommendation and search for a JPG/GIF cropping perl module/. thanks Dan On Mon, Nov 23, 2009 at 3:16 PM, Glenn Linderman wrote: > On approximately 11/22/2009 3:56 AM, came the following characters from the > keyboard of Daniel Burgaud: > >> Hi >> >> >> PerlTK's Photo does not accept bmp format. >> >> $mw->Photo('image1', -file => "screen.bmp" , -format=>"bmp"); >> $frames{'XX'}->configure( -image => 'image1' ); >> >> screen.bmp is a screen capture created using PrintScreen and Clipboard. >> > > Could you sidestep this issue by using Tk features to do the screen capture > in a format it understands? > > http://www.perlmonks.org/index.pl?node_id=361299 describes one way, dunno > if it can be ported to Windows or not. > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problem with SendKeys, Clipboard and Tk
HI I am experiencing a bug with SendKeys, Clipboard and Tk: ### #FILE: x.pl use strict; use Win32::GuiTest qw(SendKeys); use Win32::Clipboard; Win32::Clipboard->Empty(); sub CaptureScreen { SendKeys('{PRTSCR}'); my $screen = Win32::Clipboard::GetBitmap(); open DFILE, ">x.bmp"; binmode DFILE; print DFILE $screen; close DFILE; } CaptureScreen(); ## Above is a simple Screen Capture using SendKeys and Clipboard. It saves the captured screen to a file called x.bmp. I find no problem with this script. Now here is the problem: ## use strict; use Time::HiRes qw(time usleep); use Win32::GuiTest qw(GetCursorPos SendKeys); use Win32::Clipboard; Win32::Clipboard->Empty(); use Tk; my $mw = MainWindow->new( -bg => "#F0F0F0" ); my %frames; $mw->minsize(250,300); $mw->maxsize(250,300); $frames{'B'}= $mw->Frame( -borderwidth => 0, )->pack( -side => 'left', -expand => 0, -fill => 'y', ); $frames{'B.LR'}= $frames{'B'}->Label( -text=>'Capture', )->pack( -side=>"top", -expand=>1, -fill=>'both', ); BINDER(\$frames{'B.LR'}); sub BINDER { my $x = shift; $$x->bind('' => sub{ $$x->configure(-cursor=>'dot', -relief=>'raised', -fg=>"Yellow", -font=>['Arial',12,'normal'] ); $mw->update(); }); $$x->bind(''=> sub{ $$x->configure(-cursor=>'arrow', -relief=>'groove', -fg=>'Yellow', -font=>['Arial',12,'bold' ]); CaptureScreen(); $mw->update(); }); $$x->bind('' => sub{ $$x->configure(-cursor=>'arrow', -relief=>'sunken', -fg=>"Black", -font=>['Arial',12,'normal']); $mw->update(); }); } sub CaptureScreen { SendKeys('{PRTSCR}'); my $screen = Win32::Clipboard::GetBitmap(); open DFILE, ">y.bmp"; binmode DFILE; print DFILE $screen; close DFILE; } while (1) { $mw->update(); usleep(5000); } ## I added a simple Tk Window and a Label wherein you can "ButtonRelease-1" to initiate capturing the screen. This one does not work. It captures nothing and saves a blank file "y.bmp". Any idea why and how to solve thsi problem? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
PerlTK's Photo does not accept bmp format
Hi PerlTK's Photo does not accept bmp format. $mw->Photo('image1', -file => "screen.bmp" , -format=>"bmp"); $frames{'XX'}->configure( -image => 'image1' ); screen.bmp is a screen capture created using PrintScreen and Clipboard. error: Tk::Error: Compressed BMP files not (yet) supported at C:/Perl/lib/Tk/Image.pm line 21. Tk callback for image Tk::Image::new at C:/Perl/lib/Tk/Image.pm line 21 Tk::Image::__ANON__ at C:/Perl/lib/Tk/Image.pm line 63 so.. the only solution would be using GIF? Magick isnt working for me.. Does anyone have a solution to forcing Photo to accept BMP file? or a way of converting BMP files into GIF without using third party dll/exe files or using Magick? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: need help installing guitest
Hi all.. I wasnt paying enough attention to the error and realized, PPM was not allowed by firewall.. it was running on a fresh XP install where most are restricted. My bad. Thanks for the help. Dan On Wed, Nov 18, 2009 at 10:31 PM, Brian Raven wrote: > > From: perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of > Daniel Burgaud > Sent: 18 November 2009 13:52 > To: Perl-Win32-Users > Subject: need help installing guitest > > > hi > > > > After a reinstall of windows xp, i reinstalled perl as well.. > > now comes the fun part: I could not install Win32-guitest. > > > > PPM is no help either.. I've already added the other reposities > > and guitest isnt there. > > > > Currently, I just dumped my old perl installation into the new xp > system. > > but im stuck using old perl version this way unfortunately. > > > > What is the procedure for installing guitest? i forgot it the last > > time i installed it a year back. > > I am running version 5.10.0, build 1004, and ppm is telling me that > version 1.54 of Win32-Guitest is available from both the uwinnipeg and > bribes repositories. > > Which version of Avtivestate perl are you using? Which repositories have > you tried? > > HTH > > -- > Brian Raven > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient or have received this e-mail in error, please > advise the sender immediately by reply e-mail and delete this message and > any attachments without retaining a copy. > > Any unauthorised copying, disclosure or distribution of the material in > this e-mail is strictly forbidden. > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
need help installing guitest
hi After a reinstall of windows xp, i reinstalled perl as well.. now comes the fun part: I could not install Win32-guitest. PPM is no help either.. I've already added the other reposities and guitest isnt there. Currently, I just dumped my old perl installation into the new xp system. but im stuck using old perl version this way unfortunately. What is the procedure for installing guitest? i forgot it the last time i installed it a year back. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help with RE:
Hi, my $line = "Unconfirmed"; I need an RE that will give me a TRUE value if the string is 2~8 chars long. otherwise, it gives FALSE; I tried if ($line =~ /\S{2,8}/) { return 1; } else { return 0; } However this does not work. I cannot use length($line) because it has to be Regular expression. Thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
where is Win32-DDE
Hi Does anyone know where to get DDE? CPAN nor PPM does not have it. Otherwise, anyone knowledgeable on the DDE Protocol instead? ie, I'd like to write one or at least try to. ;) Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
I need perlctrl example pls
Hi Does anyone know how to use PerlCtrl? ie, converting perl scripts into dll files? If so, can you send a simple sample? and the PerlCtrl parameter as well? thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: need help with Tk: I could not figure the error
Hi When I moved all the variables within the subroutines outside, this script suddenly worked flawlessly. What gives? Wasnt it highly desireable to "localize" variables to make it more organized? yet when i did just that, it fails to run. Only when I made all variables GLOBAL that it worked. This is wierd.. Dan On Thu, Sep 3, 2009 at 12:05 AM, Daniel Burgaud wrote: > Hi All, > > Here is the message I got after using "use warnings;" and "use > diagnostics;". > > Variable "$number" will not stay shared at x.pl line 36 (#1) > (W closure) An inner (nested) named subroutine is referencing a > lexical variable defined in an outer subroutine. > > When the inner subroutine is called, it will probably see the value of > the outer subroutine's variable as it was before and during the *first* > call to the outer subroutine; in this case, after the first call to the > outer subroutine is complete, the inner and outer subroutines will no > longer share a common value for the variable. In other words, the > variable will no longer be shared. > > Furthermore, if the outer subroutine is anonymous and references a > lexical variable outside itself, then the outer and inner subroutines > will never share the given variable. > > This problem can usually be solved by making the inner subroutine > anonymous, using the sub {} syntax. When inner anonymous subs that > reference variables in outer subroutines are called or referenced, they > are automatically rebound to the current values of such variables. > > Variable "$flag" will not stay shared at x.pl line 40 (#1) > Variable "%t" will not stay shared at x.pl line 48 (#1) > > Apparently, I dont understand the above and what it meant. It appears that > the variables inside the subroutine is being reused or wrongly used. > because i > am now getting this error: > > Tk::Error: Can't call method "configure" on an undefined value at x.pl line > 48. > Tk callback for .toplevel.frame.button5 > Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 > Tk::Button::butUp at C:/Perl/lib/Tk/Button.pm line 111 > > (command bound to event) > > Line 48 is referring to: > $t{LZ}->configure(-text=>$number); > > 1st time it runs, no problem; 2nd time it gave that error as if the > variable > $t{LZ} does not exists. > > > Any idea where i am doing wrong? > > BTW. I cannot use withdraw/iconfy because the Keypress event will be used > on another > TopLevel and thus i have to destroy this toplevel everytime it leaves. > > Dan > > > > > On Wed, Sep 2, 2009 at 11:13 PM, Brian Raven wrote: > >> From: perl-win32-users-boun...@listserv.activestate.com >> [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of >> Daniel Burgaud >> Sent: 02 September 2009 15:27 >> To: Perl-Win32-Users >> Subject: need help with Tk: I could not figure the error >> >> > I have this test script below. >> > >> > A toplevel containing a button that invokes another toplevel. >> > The first time I invoke this second window, all works fine and returns >> properly without error. >> > >> > however, when I reenter again (clicking on "Get Number" button) I get >> this error message. >> > >> > Tk::Error: not a Tk object >> > Tk::die_with_trace at x.pl line 46 >> > main::AddNumber at x.pl line 66 >> > main::__ANON__ at C:/Perl/lib/Tk.pm line 252 >> > (eval) at C:/Perl/lib/Tk.pm line 252 >> > Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 >> > Tk::Button::butUp at x.pl line 79 >> > (eval) at x.pl line 79 >> > main::GetNumber at x.pl line 17 >> > main::__ANON__ at C:/Perl/lib/Tk.pm line 252 >> > (eval) at C:/Perl/lib/Tk.pm line 252 >> > Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 >> > Tk::Button::butUp at x.pl line 20 >> > (eval) at x.pl line 20 >> > Tk callback for .toplevel.frame.button5 >> > Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 >> > Tk::Button::butUp at C:/Perl/lib/Tk/Button.pm line 111 >> > >> > (command bound to event) >> > >> > Hoping for help. >> > >> > thanks. >> > Dan >> > >> > >> > >> > >> >> >> > use strict; >> >> perl will give you a clue if you add "use warnings;" here. It will even >> give
Re: need help with Tk: I could not figure the error
Hi All, Here is the message I got after using "use warnings;" and "use diagnostics;". Variable "$number" will not stay shared at x.pl line 36 (#1) (W closure) An inner (nested) named subroutine is referencing a lexical variable defined in an outer subroutine. When the inner subroutine is called, it will probably see the value of the outer subroutine's variable as it was before and during the *first* call to the outer subroutine; in this case, after the first call to the outer subroutine is complete, the inner and outer subroutines will no longer share a common value for the variable. In other words, the variable will no longer be shared. Furthermore, if the outer subroutine is anonymous and references a lexical variable outside itself, then the outer and inner subroutines will never share the given variable. This problem can usually be solved by making the inner subroutine anonymous, using the sub {} syntax. When inner anonymous subs that reference variables in outer subroutines are called or referenced, they are automatically rebound to the current values of such variables. Variable "$flag" will not stay shared at x.pl line 40 (#1) Variable "%t" will not stay shared at x.pl line 48 (#1) Apparently, I dont understand the above and what it meant. It appears that the variables inside the subroutine is being reused or wrongly used. because i am now getting this error: Tk::Error: Can't call method "configure" on an undefined value at x.pl line 48. Tk callback for .toplevel.frame.button5 Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 Tk::Button::butUp at C:/Perl/lib/Tk/Button.pm line 111 (command bound to event) Line 48 is referring to: $t{LZ}->configure(-text=>$number); 1st time it runs, no problem; 2nd time it gave that error as if the variable $t{LZ} does not exists. Any idea where i am doing wrong? BTW. I cannot use withdraw/iconfy because the Keypress event will be used on another TopLevel and thus i have to destroy this toplevel everytime it leaves. Dan On Wed, Sep 2, 2009 at 11:13 PM, Brian Raven wrote: > From: perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of > Daniel Burgaud > Sent: 02 September 2009 15:27 > To: Perl-Win32-Users > Subject: need help with Tk: I could not figure the error > > > I have this test script below. > > > > A toplevel containing a button that invokes another toplevel. > > The first time I invoke this second window, all works fine and returns > properly without error. > > > > however, when I reenter again (clicking on "Get Number" button) I get > this error message. > > > > Tk::Error: not a Tk object > > Tk::die_with_trace at x.pl line 46 > > main::AddNumber at x.pl line 66 > > main::__ANON__ at C:/Perl/lib/Tk.pm line 252 > > (eval) at C:/Perl/lib/Tk.pm line 252 > > Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 > > Tk::Button::butUp at x.pl line 79 > > (eval) at x.pl line 79 > > main::GetNumber at x.pl line 17 > > main::__ANON__ at C:/Perl/lib/Tk.pm line 252 > > (eval) at C:/Perl/lib/Tk.pm line 252 > > Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 > > Tk::Button::butUp at x.pl line 20 > > (eval) at x.pl line 20 > > Tk callback for .toplevel.frame.button5 > > Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 > > Tk::Button::butUp at C:/Perl/lib/Tk/Button.pm line 111 > > > > (command bound to event) > > > > Hoping for help. > > > > thanks. > > Dan > > > > > > > > > > > > use strict; > > perl will give you a clue if you add "use warnings;" here. It will even > give some advice if you make it "use diagnostics;". > > > use Tk; > > ... > > HTH > > -- > Brian Raven > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient or have received this e-mail in error, please > advise the sender immediately by reply e-mail and delete this message and > any attachments without retaining a copy. > > Any unauthorised copying, disclosure or distribution of the material in > this e-mail is strictly forbidden. > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
need help with Tk: I could not figure the error
I have this test script below. A toplevel containing a button that invokes another toplevel. The first time I invoke this second window, all works fine and returns properly without error. however, when I reenter again (clicking on "Get Number" button) I get this error message. Tk::Error: not a Tk object Tk::die_with_trace at x.pl line 46 main::AddNumber at x.pl line 66 main::__ANON__ at C:/Perl/lib/Tk.pm line 252 (eval) at C:/Perl/lib/Tk.pm line 252 Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 Tk::Button::butUp at x.pl line 79 (eval) at x.pl line 79 main::GetNumber at x.pl line 17 main::__ANON__ at C:/Perl/lib/Tk.pm line 252 (eval) at C:/Perl/lib/Tk.pm line 252 Tk::__ANON__ at C:/Perl/lib/Tk/Button.pm line 111 Tk::Button::butUp at x.pl line 20 (eval) at x.pl line 20 Tk callback for .toplevel.frame.button5 Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 Tk::Button::butUp at C:/Perl/lib/Tk/Button.pm line 111 (command bound to event) Hoping for help. thanks. Dan use strict; use Tk; use Time::HiRes qw(time usleep); my $BGColor0 = "#D8D0C8"; my $BGColor1 = "#D0D0D0"; my $BGColor2 = "#808080"; my $BGColor3 = "#5090C0"; my $BGColor4 = "#4070A0"; my $BGColor5 = "#80C080"; my $BGColor6 = "#408040"; my $BGColor7 = "#FF"; my $BGColor8 = "#E0E0E0"; my $BGColor9 = "#FF8080"; my $mw = MainWindow->new; $mw->title("MainWindow"); $mw->Button(-text => "Get Number",-command => sub {&GetNumber('Enter Number')})->pack( ); while(1) { $mw->update; usleep 5000; } sub GetNumber { my $title = shift; my %t; my $number = 0; my $flag = 1; sub AddNumber { my $key = shift; if ('0123456789' =~ $key) { $number .= $key; } elsif ($key eq 'period' && $number !~ /\./) { $number .= '.'; } elsif ($key eq 'Return') { $flag = 0; } elsif ($key eq 'Escape') { $number = ''; $flag = 0; } elsif ($key eq 'BackSpace') { chop($number); chop($number) if substr($number,-1) eq '.'; } $t{LZ}->configure(-text=>$number); } sub Keyboard { my $widget = shift; my $e = $widget->XEvent;# get event object my $key = $e->K; AddNumber($key); } $t{L0} = $mw->Toplevel(-title=>$title); $t{L0}->resizable(0,0); $t{L0}->transient($t{L0}->Parent->toplevel); $t{LT}= $t{L0}->Label( -borderwidth=>2, -bg=>$BGColor3, -fg=>'#00', -font=>['Arial',20,'bold'], -relief=>'groove', -anchor=>"c", -text=>$title)->pack( -side=>"top", -expand=>1, -fill=>'x', ); $t{LZ}= $t{L0}->Label( -borderwidth=>4, -bg=>$BGColor7, -fg=>'#00', -font=>['Arial',40,'bold'], -relief=>'groove', -anchor=>"e", )->pack( -side=>"top", -expand=>1, -fill=>'x', ); $t{L1}= $t{L0}->Frame( -borderwidth=>2, )->pack( -side=>'left', -expand=>1, -fill=>'both'); $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "7", -font=>['Courier',30,'bold'], -command => sub{AddNumber('7')}, )->grid( $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "8", -font=>['Courier',30,'bold'], -command => sub{AddNumber('8')},), $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "9", -font=>['Courier',30,'bold'], -command => sub{AddNumber('9')},), -sticky=>'news'); $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "4", -font=>['Courier',30,'bold'], -command => sub{AddNumber('4')}, )->grid( $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "5", -font=>['Courier',30,'bold'], -command => sub{AddNumber('5')},), $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "6", -font=>['Courier',30,'bold'], -command => sub{AddNumber('6')},), -sticky=>'news'); $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "1", -font=>['Courier',30,'bold'], -command => sub{AddNumber('1')}, )->grid( $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "2", -font=>['Courier',30,'bold'], -command => sub{AddNumber('2')},), $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "3", -font=>['Courier',30,'bold'], -command => sub{AddNumber('3')},), -sticky=>'news'); $t{L1}->Button( -borderwidth=>3, -bg=>$BGColor3, -activebackground=>$BGColor4, -width=>4, -height=>1, -text => "0", -font=>['Courier',30,'bold'], -command => sub{AddNumber('0')}, )->grid( $t{L1}->Button( -b
Re: need help: TK windows - no task bar icon pls
Hi, Thanks for the idea and i finally solved the problem. The secret was the method transient as shown below. With it, there is no task bar icon. Without it, another task bar icon pops up. Thanks! Dan use Tk; $mw = MainWindow->new; $mw->title("MainWindow"); $mw->Button(-text => "Toplevel", -command => \&do_Toplevel)->pack( ); MainLoop; sub do_Toplevel { if (! Exists($tl)) { $tl = $mw->Toplevel( ); $tl->transient($tl->Parent->toplevel); $tl->title("Toplevel"); $tl->Button(-text => "Close", -command => sub { $tl->destroy; undef $tl})->pack; } else { $tl->deiconify( ); $tl->raise( ); } } On Tue, Sep 1, 2009 at 7:16 PM, Brian Raven wrote: > From: perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of > Daniel Burgaud > Sent: 01 September 2009 11:08 > To: Perl-Win32-Users > Subject: need help: TK windows - no task bar icon pls > > > Hi > > > > I have a perl script with a main TK: > > > > my $MW = MainWindow->new(); > > > > > > Within, I have routines that requires a popup. > > > > sub POPUP { > > my $popup = $MW->TopLevel(); > > . > > . > > . > > while(1) { > > usleep 5000; > > $popup->focus; > > . > > . > > . > > } > > } > > > > I do not like to use dialog or dialogbox because i need a popup that > > performs complex task, dialog or dialogbox is not up to task. > > > > My problem is, this popup creates "another" task bar icon separate > from > > the mainwindow. how do I make it not create another task bar icon? > > Dialog/DialogBox does not have this taskbar icon... > > As DialogBox derives directly from TopLevel, I expect that the answer > lies somewhere in DialogBox.pm, probably in its Populate and Show > methods. My first guess would be that it is something to do with the > calls to transient, withdraw and Popup, although I can see no > documentation for Popup in TopLevel or its obvious base classes. > > Unless somebody comes up with a better answer, try copying DialogBox.pm, > make mods to it and see what happens. If you discover the answer from > that, don't forget to let us know what it is. > > HTH > > -- > Brian Raven > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient or have received this e-mail in error, please > advise the sender immediately by reply e-mail and delete this message and > any attachments without retaining a copy. > > Any unauthorised copying, disclosure or distribution of the material in > this e-mail is strictly forbidden. > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
need help: TK windows - no task bar icon pls
Hi I have a perl script with a main TK: my $MW = MainWindow->new(); Within, I have routines that requires a popup. sub POPUP { my $popup = $MW->TopLevel(); . . . while(1) { usleep 5000; $popup->focus; . . . } } I do not like to use dialog or dialogbox because i need a popup that performs complex task, dialog or dialogbox is not up to task. My problem is, this popup creates "another" task bar icon separate from the mainwindow. how do I make it not create another task bar icon? Dialog/DialogBox does not have this taskbar icon... Many Thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help with printf/sprintf
Hi I have a problem with printf/sprintf Basically I have this code: printf "%-50s %10.2f\n", $item, $price; This code prints a line that is 61 chars long with the Item's name on the Left and Price on the right. However, I want to make it variable width based on either screen width, or user input: ie, print "%-$Ws %10.2f\n", $item, $price; Obviously, this does not work. How do I code it to work like i want it? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: problem with Tk Frame not filling the whole frame.
Hi Thanks Jack for the example. here is where the problem i am encountering. In your example the Left Frame was declared with -expand => 0: my $frameLeft = $mainFrame->Frame( -bg=>'red',-borderwidth => 1, -width => 50, )->pack( -side => 'left', -expand => 0, -fill => 'y'); expand = 0 implies it will not expand to fill available space right? yet when I execute it, it did what I want to do. Naturally, I would code it with expand = 1, fill = 'y' Accordingly, this should fill only the vertical and not horizontal. And when I did so, its not doing what I want it. This is where I am very confused!!! Anyway, assuming I want is to have a Frame "clerk.right". And in this frame, I want to divide it into 5 namely: North, South, West, East and X The N, S, are top/bottom border with predefined height of 50. the W, E are Left, Right border with predefined width of 50 also. the rest is X and X (yellow) is to occupy the whole remaining frame. ### use Tk; my $mw = MainWindow->new( ); $mw->minsize(); $TK{'clerk.right'}= $mw->Frame( )->pack( -side => 'right', -expand => 1, -fill => 'both'); $TK{'clerk.N'}= $TK{'clerk.right'}->Frame( -height => 50, -background => 'blue' )->pack( -side => 'top', -expand => 1, -fill => 'x'); $TK{'clerk.S'}= $TK{'clerk.right'}->Frame( -height => 50, -background => 'green' )->pack( -side => 'bottom', -expand => 1, -fill => 'x'); $TK{'clerk.W'}= $TK{'clerk.right'}->Frame( -width => 50, -background => 'red' )->pack( -side => 'left', -expand => 0, -fill => 'y'); $TK{'clerk.X'}= $TK{'clerk.right'}->Frame( -background => 'yellow')->pack( -side => 'left', -expand => 1, -fill => 'both'); $TK{'clerk.E'}= $TK{'clerk.right'}->Frame( -width => 50, -background => 'black' )->pack( -side => 'left', -expand => 0, -fill => 'y'); MainLoop; ### The result is that the Frame X is just a thin horizontal line! its not occupying the whole remaining space. This code isnt doing what I want it to. Where is my Error here? Dan On Sat, Aug 1, 2009 at 1:52 AM, Jack wrote: > Again - sorry for the top post.. > > I'm not completely sure of what you want, but I think you want some sort of > "bar" down the left side. You have to turn the expand option to off for > that > to "not" allocate anymore space in the x direction on a resize. Otherwise > the packer will split it 50/50 with the righthand frame. > > This will do what I describe - which is yet to be decided what you really > want: > > # > use Tk; > use strict; > > my $mw=tkinit; > my $mainFrame = $mw->Frame()->pack(-expand=>1, -fill => 'both'); > my $frameLeft = $mainFrame->Frame( -bg=>'red',-borderwidth => 1, -width => > 50, )->pack( -side => 'left', -expand => 0, -fill => 'y'); > my $frameRight = $mainFrame->Frame( -bg=>'yellow', -borderwidth => 1, > )->pack( -side => 'left', -expand => 1, -fill => 'both'); > > MainLoop; > # > > Suggestion..it would be easier to help if you provided fully working > programs that show the problem as opposed to code snippets (which had some > typos). > > Jack > > > > > > From: perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of > Daniel Burgaud > Sent: July-31-09 4:52 AM > To: Perl-Win32-Users > Subject: problem with Tk Frame not filling the whole frame. > > > Hi, > > I have a Frame and within this Frame, I have 2 more Frames: > > $mainFrame = $mw->Frame()->pack(-expand=>1, fill = 'both'); > > $frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack( > -side => 'left', -expand => 1, -fill => 'y'); > $frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side => > 'right', -expand => 1, -fill => 'both'); > > > How come the sub frames isnt filling the whole mainFrame? > Why? What option/method must I use to force these two sub frames to fill > the > mainFrame? > > I also tried it within a Notebook (instead of main Frame) with same effect: > > $mainFrame = $TK{'notebook'}->add('item',-label => ' Main Frame '); > $frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack( > -side => 'left', -expand => 1, -fill => 'y'); > $frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side => > 'right', -expand => 1, -fill => 'both'); > > Need Help. Thanks! > > Dan > > > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
need help with Tk's bind/tags
Hi, I have: foreach my $i (a list from a database server) { $TK{'item'}->tag( 'bind', "I$i", '<1>' => sub { &SelectItem($i) } ); } Is there a function or array that will lists all the binds/tags for a particular widget? Though the list is available by querying the database server again, however, doing so would be inefficient. Does this list even exists? I could always try saving the list into an array though.. but i wanted to know if this isnt duplicating anything that is already there. thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Need help removing blinking cursor on a TK Scrolled
Hi I have a Scrolled ROText: $scrolled = $mw->Scrolled( 'ROText', -relief => 'flat', -borderwidth => 1, -scrollbars => 'e', -cursor => 'top_left_arrow', -width =>200, -height => 30, )->pack( -side => 'top', -expand => 1, -fill => 'both', ); My problem is that there is this annoying thin blinking cursor that is ruining the display. ie, there is already a "top_left_arrow" cursor controlled by the mouse and another blinking cursor which the users of the software would think as a "point of input" for key-presses. And when they do, they get frustrated why its not inserting text. Is there a way to hide this blinking cursor? Off hand, the only way for me to hide it is to change this Scrolled' background to black to match the color of this blinking cursor.. but black background is not suitable for this application. thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
problem with Tk Frame not filling the whole frame.
Hi, I have a Frame and within this Frame, I have 2 more Frames: $mainFrame = $mw->Frame()->pack(-expand=>1, fill = 'both'); $frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack( -side => 'left', -expand => 1, -fill => 'y'); $frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side => 'right', -expand => 1, -fill => 'both'); How come the sub frames isnt filling the whole mainFrame? Why? What option/method must I use to force these two sub frames to fill the mainFrame? I also tried it within a Notebook (instead of main Frame) with same effect: $mainFrame = $TK{'notebook'}->add('item',-label => ' Main Frame '); $frameLeft = $mainFrame->Frame( -borderwidth => 1, width => 50, )->pack( -side => 'left', -expand => 1, -fill => 'y'); $frameRight = $mainFrame->Frame( -borderwidth => 1, )->pack( -side => 'right', -expand => 1, -fill => 'both'); Need Help. Thanks! Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
What TK Method for hiding a widget?
Hi, I am looking for that Tk method that will hide widgets rendering it invisible. specifically, I'd like to hide a Frame whenever a DialogBox pops up asking for authentication. I do not want to destroy this Frame though doing so would require me to redo everything within this Frame. Thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Where can I find list of TK's methods and options?
Hi Where can I find a "complete" list of methods and options for TK. Currently, the HTML help file that comes with activeperl installation is very vague on the methods oftentimes assuming that I already know them *all*. I could not find a nice documentation at all. Knowing these methods (functions) oftentimes lead to better program design and faster programming as well. Just for instance, I never knew that a certain method "state('zoom')" exists and I have been using win32 GUItest to "mouse click" on the Maximize button to maximize the window! Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
DOS type window/screen module?
Hi, I am developing an application and opted to use only keyboards (no mouse) for inputs and controls; basically something that one would do back in the old DOS days using mainly the cursor keys, tabs and the like. Is there any modules out there that handles this kind of screen/windows? thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q on TK's Balloon
Hi Is there a way to forcefully pop (show up) a TK Balloon? as well as forcefully make it disappear? basically, I want a popup window to show some simple messages. a standard Frame, Dialog, Label occupies too much space. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q with TK Scrolled: remove the blinking cursor
Hi I have this TK: $scroll = $mw->Scrolled( 'ROText', -scrollbars => 'e', -cursor => 'top_left_arrow', )->pack( -side => 'right', -expand => 1, -fill => 'x', ); This is a Read Only scrolled window; when I Mouse Over, the cursor changes to a "top_left_arrow" as specified. However, when I clicked on any part of the Scrolled window, there appears a blinking cursor. I find this confusing as it makes the content in this window appear "editable". Is there a way to remove the blinking cursor from this scrolled window? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
perl to dll?
Hi All, I know there is a perl to exe, but what about a perl to dll? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q: How to resize TK window panels
Hi, I have the following Perl Script. It displays two Scrolled Text Left and Right. My problem is, how to resize the widths of the panels. Is there a switch that will automatically adjust the width or I manually dragging the edges? thanks. Dan ### strict; require Win32::Console;import Win32::Console; use Time::HiRes qw(time usleep); use Tk; require Tk::ROText; my $mw = MainWindow->new( ); $mw->minsize(630,500); my %frames; $frames{'display'}= $mw->Frame( -borderwidth => 2, )->pack( -side => 'top', -expand => 1, -fill => 'both'); $frames{'display-l'}= $frames{'display'}->Scrolled('ROText', -font => ['Courier', 9,'normal'], -relief => 'groove', -scrollbars => 'e',)->pack( -side => 'left', -expand => 1, -fill => 'both', ); $frames{'display-r'}= $frames{'display'}->Scrolled('ROText', -font => ['Courier', 9,'normal'], -relief => 'groove', -scrollbars => 'e',)->pack( -side => 'right', -expand => 1, -fill => 'both', ); while (1) { $mw->update(); usleep 5; } ### ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q on TK's bind/tag
Hi First off: HAPPY NEW YEAR! I have the following sub-codes: $mw->fontCreate(qw/C_NORM -family Courier -size 9 /); $mw->fontCreate(qw/C_BOLD -family Courier -size 9 -weight bold/); . . $frames{'data-r'}= $frames{'data'}->Scrolled('ROText', ...)->pack( -side => 'top', -expand => 1, -fill => 'both', ); $frames{'data-r'}->tag(qw/configure norm foreground #00 -font C_NORM/); $frames{'data-r'}->tag(qw/configure misc foreground #00 -font C_NORM/); $frames{'data-r'}->tag( 'bind', "T$i", '' => sub { &addforPrinting($i);} ); All the while, I have been using "tag" to bind events (as per examples i found somewhere); today, I reviewed TK's HTML documents (that came with activeperl) and could not find any information on "tag". Can anyone help me "convert" these into "bind", and "configure"? $frames{'data-r'}->tag(qw/configure misc foreground #00 -font C_NORM/); $frames{'data-r'}->tag( 'bind', "T$i", '' => sub { &addforPrinting($i);} ); Lastly, after several loops, my script is corrupted with unwanted binds such that even if I do not want bind for "T1", I am getting it because it existed in previous loops. How do I remove these unwanted Binds? My mistake was I assumed that this code: $frames{'data-r'}->delete('1.0','end'); would eliminate any binds within $frames{'data-r'} but apparently it does not and only deletes the "scrolled text" contents.. thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q on TK popups
Hi, I have a Scrolled Text wherein, each line is binded to a popup $frames{'name-r'}->tag( 'bind', "A$i", '' => sub { &displayRecord($i) } ); I have been trying to use messageBox, Dialog and Balloon. * The problem with messageBox is that I could not configure the font of the message. * The problem with Dialog is that it wraps the word to a new line even if the dialog window is wide enough to contain twice the length of the message thus ruining the display. * The problem with Balloon however is that, it is difficult to control when it should show up. Currently, the Balloon is defined to show for the whole $frames{'name-r'} which therefore, would show even if the cursor isnt on top of the desired line (ie, it is displaying info for Line1 when cursor is already at Line3 or the scrolled text). My questions are: 1. Is there a way to configure font for messageBox? or 2. Is there a way to prevent Dialog from truncating the message into a new line? or 3. Is it possible to attach a Balloon to a particular line within the scrolled text? ie, it will popup only when mouseover a particular line and will unpop when un-mouseover instead of having the balloon attached to the whole scrolled text widget. 4. Or is there a different function that can solve the above? thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Q on TK Scrolled: how do scroll?
This is a test code: ## ## use strict; use Time::HiRes qw(time usleep); use Tk; require Tk::ROText; my $mw = MainWindow->new( ); $mw->minsize(450,250); $mw->maxsize(450,250); my %frames; $frames{'name'}= $mw->Frame( -borderwidth => 2, )->pack( -side => 'top', -expand => 0, -fill => 'x', ); $frames{'input'}= $mw->Frame( -borderwidth => 2, )->pack( -side => 'top', -expand => 0, -fill => 'x'); $frames{'name-l'}= $frames{'name'}->Label ( -font => ['Courier',10,'bold' ], -relief => 'groove', -anchor => 'nw', -width => 16, -text => 'Name ', )->pack( -side => 'left', -expand => 0, -fill => 'y', ); $frames{'name-r'}= $frames{'name'}->Scrolled('ROText', -font => ['Courier',10,'normal'], -relief => 'groove', -height =>10, -scrollbars => 'e', -cursor => 'top_left_arrow' )->pack( -side => 'right', -expand => 1, -fill => 'x', ); $frames{'buttonL'}= $frames{'input'}->Button( -font => ['Terminal',10,'bold'],-relief => 'raised',-width => 20, -borderwidth => 1, -text => 'GOTO 1', -command => [\&ScrollTOP] )->pack( -side => 'left', -expand => 0, -fill => 'x', -padx=>1); $frames{'buttonC'}= $frames{'input'}->Button( -font => ['Terminal',10,'bold'],-relief => 'raised',-width => 20, -borderwidth => 1, -text => 'GOTO 50', -command => [\&ScrollMID] )->pack( -side => 'left', -expand => 0, -fill => 'x', -padx=>1); $frames{'buttonR'}= $frames{'input'}->Button( -font => ['Terminal',10,'bold'],-relief => 'raised',-width => 20, -borderwidth => 1, -text => 'GOTO 90', -command => [\&ScrollBOTTOM] )->pack( -side => 'left', -expand => 0, -fill => 'x', -padx=>1); #I dont know what TK codes to use to scroll the Scrolled panel to the desired location sub ScrollTOP { } sub ScrollMID { } sub ScrollBOTTOM { } for (my $i=1; $i<=100; $i++) { $frames{'name-r'}->insert('end', "Line $i\n", "A$i"); } while (1) { $mw->update(); usleep 5; } ## ## 3 Buttons: GOTO 1 GOTO 50 GOTO 90 if I press GOTO 1, it will scroll to Line 1 If I press GOTO 50, it will scroll to Line 50 if I press GOTO 90, it will scroll to Line 90 I appreciate if you could help me on this Thanks! Dan On Sun, Dec 7, 2008 at 6:45 PM, Daniel Burgaud <[EMAIL PROTECTED]> wrote: > Hi Jack, > > > The scrollbed field is defined as: > > $frames{'name-r'} = $frames{'name'}->Scrolled ('ROText', -height => 8, > -scrollbars => 'e', )->pack( -side => 'right', -expand => 1, -fill => 'x', > > It can scroll up/down and contains text. > > I want to do a "search" and therefore the script should display the part > where the search string is located within this scrolled field. > > I dont know how to write that part of the script because I dont know how > to. > I hope you understood my question. > > So basically, I want the script to automatically scroll to the location > where > this text is located. > > I have tried playing with: > $frames{'name-r'}->set(0.5, 0.6) > $frames{'name-r'}->see(0.5) > with no success - I totally dont have a clue what these two did too. > > Hoping for help. > > Dan. > > > > > > On Sun, Dec 7, 2008 at 1:07 PM, Jack <[EMAIL PROTECTED]> wrote: > >> >> ___ >> >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of >> Daniel Burgaud >> Sent: December-06-08 7:16 PM >> To: Perl-Win32-Users >> Subject: Q on TK Scrolled: how do scroll? >> >> >> >I have a TK scrollbar defined as follows: >> >> >$frames{'name-r'} = $frames{'name'}->Scrolled ('ROText', -height => 8, >> -scrollbars => 'e', )->pack( -side => 'right', -expand => 1, -fill => >> 'x', >> ); >> >> >My problem is: >> >> >How do I command it to show the middle, the bottom, the top of the >> scrollbar? >> >> ### >> I can likely help - but I really don't understand your question. >> What do you mean by "show the middle, bottom and top"? >> >> Perhaps you can post a small sample program that demonstrates your >> problem. >> >> Jack >> >> >> ___ >> Perl-Win32-Users mailing list >> Perl-Win32-Users@listserv.ActiveState.com >> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs >> > > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Q on TK Scrolled: how do scroll?
Hi Jack, The scrollbed field is defined as: $frames{'name-r'} = $frames{'name'}->Scrolled ('ROText', -height => 8, -scrollbars => 'e', )->pack( -side => 'right', -expand => 1, -fill => 'x', It can scroll up/down and contains text. I want to do a "search" and therefore the script should display the part where the search string is located within this scrolled field. I dont know how to write that part of the script because I dont know how to. I hope you understood my question. So basically, I want the script to automatically scroll to the location where this text is located. I have tried playing with: $frames{'name-r'}->set(0.5, 0.6) $frames{'name-r'}->see(0.5) with no success - I totally dont have a clue what these two did too. Hoping for help. Dan. On Sun, Dec 7, 2008 at 1:07 PM, Jack <[EMAIL PROTECTED]> wrote: > > ___ > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Daniel Burgaud > Sent: December-06-08 7:16 PM > To: Perl-Win32-Users > Subject: Q on TK Scrolled: how do scroll? > > > >I have a TK scrollbar defined as follows: > > >$frames{'name-r'} = $frames{'name'}->Scrolled ('ROText', -height => 8, > -scrollbars => 'e', )->pack( -side => 'right', -expand => 1, -fill => 'x', > ); > > >My problem is: > > >How do I command it to show the middle, the bottom, the top of the > scrollbar? > > ### > I can likely help - but I really don't understand your question. > What do you mean by "show the middle, bottom and top"? > > Perhaps you can post a small sample program that demonstrates your problem. > > Jack > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q on TK Scrolled: how do scroll?
I have a TK scrollbar defined as follows: $frames{'name-r'} = $frames{'name'}->Scrolled ('ROText', -height => 8, -scrollbars => 'e', )->pack( -side => 'right', -expand => 1, -fill => 'x', ); My problem is: How do I command it to show the middle, the bottom, the top of the scrollbar? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
problem with TK
Hi I have a problem with TK. for (my $i = 0; exists $transactions{$account}[$i]; $i++) { next if $transactions{$account}[$i]{'type'} < 0;#do not display this . . . $frames{'data-r'}->insert('end', $line, ["T$i", $colortag]); print "debug: $i\n"; A$frames{'data-r'}->tag( 'bind', "T$i", '<1>' => sub { &selectTransaction($i); } ); B$frames{'data-r'}->tag( 'bind', "T$i", ''=> sub { &deleteTransaction($i); } ); C$frames{'data-r'}->tag( 'bind', "T$i", '' => sub { &addforPrinting($i);} ) if $type == 0; push @selections, $i; } Why is it that the function calls selectTransaction, deleteTransactions and addforPrinting (Lines A,B,C) always receive only one value which is the last value of $i even if the print line would enumerate all the values. This piece of code however works: foreach my $i (sort {$accounts{$a}{'name'} cmp $accounts{$b}{'name'}} keys %accounts) { $frames{'name-r'}->insert('end', "\n") if $flag; $line = sprintf "%-50s %10s",$accounts{$i}{'name'},$accounts{$i}{'VAT'}; $frames{'name-r'}->insert('end', $line, "A$i"); X$frames{'name-r'}->tag( 'bind', "A$i", '<1>' => sub { &selectAccount($i) } ); Y$frames{'name-r'}->tag( 'bind', "A$i", '' => sub { &markAccount($i) } ); $flag++; } In this code, selectAccount($i) and markAccount($i) (Lines X,Y) receives the paramater properly. Why is the 1st code not working, while the second one works? Need help. Im at my wits end figuring this out. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
question on TK
Hello, I am using TK and have multiple "MainWindow->new()" windows. My 1st problem is: How do I "disable" or "make invisible" (or any other means to prevent user from doing anything on these "disabled" windows? 2nd problem is: How do I close a window without closing the whole application? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
problem with print
Hi I have a simple script that uses print in a loop to update the screen something like this: for ( ) { . . . print "."; } print "\n"; The problem, while within the loop, the screen does not update. Only once print "\n" is encountered will the screen display the whole printout. How do I ensure that each print gets displayed immediately without having to wait for the newline? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
PerlTK: Window Always on Top
Hi, I have an application wherein it calls a tk window asking the user to fill a form. I need this tk window to be always on top. how do i do it with TK? Or do I use a separate module for doing this (GUITest)? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q with Tk; removing Label and Button
Hi I created some Label and Button using the following: $frames{$ticket}{'main'} = $TOP->Frame( -width => 250, -height => 60, -borderwidth => 2, -relief => 'sunken', -background => "#FF", )->pack(-side=>'top', -fill=>'x', -pady=>1); $frames{$ticket}{Label } = $frames{$ticket}{'main'}->Label ( -font => ['Verdana',8,'normal'], -relief => 'raise', -text => $name, -bg => $color, -activebackground => $color,); $frames{$ticket}{Close } = $frames{$ticket}{'main'}->Button( -font => ['Verdana',8,'normal'], -relief => 'raise', -text => 'Close', - command => sub{ }); My question is: How do i remove the label and button? Do I simply do undef $frames{$ticket}{Label}? I tried $frames{$ticket}{Label}->delete and it wont work. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Question: DLL and Intra Process Communication methods
Hi, I have a 3rd party application that does not have any TCP or any similar communication features to communicate with other applications. It can however use DLL calls and with that, I was able to "fetch" webpages using wininet.dll. Right now, I want this application to communicate with my Perl scripts. Any idea? Can I create DLL files out of Perl Scripts such that this 3rd party application can call it directly? Personally, I am thinking of this 3rd party apps to communicate via TCP/Socks or similar methods. I dont like using files: 3rd party apps cannot access files outside it's installed directory and perl script do not know where these 3rd party apps are installed. Maybe there is a built-in windows DLL (user32.dll, kernel32.dll etc.) that can be used to send/receive TCP data that can communicate with perl? Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Term::ReadKey does not work with TK?
Hi, I just realized Term::ReadKey does not work with TK, or is it? Is there any way for me to read keypresses from TK? My TK application is mostly a Canvasand I need to plot/draw the keypressed characters directly into this canvas. Thus far the solution I am using is IsKeyPressed (Win32::GuiTest) but this does not probe to be efficient and likewise, I found a bug with IsKeyPressed and SendRawKey Any help is appreciated. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problem with Win32::GuiTest
Hi My intention was to use IsKeyPressed($c) to check if the user pressed any of the keys as enumerated in a program. Then sometime in the process, the program has to output the result to another application using MouseMoveAbsPix and SendRawKey. Up to this point, the application works OK. However, when the application went back to the IsKeyPressed part, it kept getting keypresses even if the user did not pressed any key. Its as if the SendRawKey's output were stuck with the IsKeypressed. So I wrote the test script below: When I run this test script, it works exactly as I wanted it. It will echo to screen the chars 1-9 X and P. No Problem thus far. So I uncomment the SendRawKey; and now, it keeps printing endlessly the numbers 1 to 9. What happened? Why is the numbers 1-9 stuck with IsKeyPressed? And at this time, even if I comment/remove the SendRawKey from this test script, I keep getting the IsKeypressed non-stop. What happened? Dan use strict; use Time::HiRes qw(time usleep); use Win32::GuiTest qw(IsKeyPressed GetCursorPos MouseMoveAbsPix SendMouse SendKeys SendRawKey); for (my $i=0; $i<10; $i++) { #SendRawKey(ord($i),"KEYEVENTF_KEYDUP"); } while (1) { foreach my $c (qw|1 2 3 4 5 6 7 8 9 X P|) { if (IsKeyPressed($c)) { print $c,"\n"; } } usleep 1; } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Happy 20th Birthday, Perl!
Happy Birthday! Perl is the programming language that I used for the longest time ever (more than 10 years!). And I will continue using it for many more years to come! Dan On Dec 19, 2007 5:30 AM, Howard Maher <[EMAIL PROTECTED]> wrote: > I don't know about you all, but I think that we all should take a moment > to celebrate Perl's 20th birthday today... > > It just seems so not long ago, December 18th, 1987... a tiny little one > was born of man but had an existence so ethereal and unworldly that it truly > could bless millions of objects at once throughout the world. > > HAPPY BIRTHDAY, PERL! > > Howard > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with USB Printer
Hi, Some years ago, I encountered similar problem. My printer dont accept plain text. And it uses its own proprietary protocol (Canon LBP800). I can no longer use the simple print to LPT syntax.. The only solution was to create GIF/JPEG files from the text I wanted to print. Then use MSPaint to print it to printer as graphics. It is indeed slower but it turned out to be more flexible. Not only as I able to print text, I can also combine graphics etc.. Its been years and I now dump my printables into a PDF file, and use PDF reader to print to printer. I find that PDF is faster than creating gif files. Secondly, I can collate all what I need to print into a single PDF file.. This process requires more step than the previous one - but each has its unique advantage/disadvantages.. You may want to solve it this way. Dan On Dec 9, 2007 10:13 AM, Valerie <[EMAIL PROTECTED]> wrote: > Hello all! > > I have written a PERL/Tk program to take input from a user and to > print a report back based on the data. It works fine on my Windows > XP system with an HP Laserjet 6MP connected to a standard parallel > port (LPT1). When I copy the program to a different computer > running the same OS but with a different model HP laser printer > (model 1012) connected to the USB port, the program hangs when I try > to print. > > Can anyone help me get this program running? If it would be easier, > I could alternatively print to a standalone network > printer/copier/scanner. This might arguably be better as then the > solution could be used from any of our computers. > > Here is an excerpt of the essential part of the program. Note, the > variables, "$v1c", "$vck01" etc. are global variables and are all > valid. As I said, the program works great on my computer. > > sub vkprint { > format vkfmttop = > DAILY CASH RECONCILIATION > Denomination Qty Value Checks Credit Cards Paid > Outs > > - > . > > format vkfmt = > @>>>@[EMAIL PROTECTED]@[EMAIL PROTECTED]@.# > # > $text1, $text2, $text3,$text4, $text5, $text6 > . > > open LPT, '>LPT1' or die "Can't open printer: $!"; > > select LPT; > $~ = 'vkfmt'; > $^ = 'vkfmttop'; > > $text1 = "1c"; > $text2 = $v1c; > $text3 = $v1c * .01; > $text4 = $vck01; > $text5 = $vcc01; > $text6 = $poe01; > write; > > [Additional write / print commands and calculations deleted for > clarity] > > print LPT "\f"; > close LPT; > } > > > Thank you for your assistance. > > Valerie > > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Q with guitest
Hi How do I "restore" a window that is minimized? thanks! Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: In need of efficient JPEG / GIF module
Hi, Charts dynamically generated by perl script. Dan On 9/25/07, Bill Luebkert <[EMAIL PROTECTED]> wrote: > > Daniel Burgaud wrote: > > Hi, > > > > > > The one I use the jpeg module dumps too large pictures, its totally > > useless for online use. > > > > I need efficient JPEG/GIF module for use on a web application. Any > > better jpeg/gif > > modules out there? > > Totally cryptic man. What specifically are you trying to do with > images ? > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
In need of efficient JPEG / GIF module
Hi, The one I use the jpeg module dumps too large pictures, its totally useless for online use. I need efficient JPEG/GIF module for use on a web application. Any better jpeg/gif modules out there? thanks. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
PerlTk: problem with notebook and canvas
Hi, Is it possible to create "Notebooks" of Canvas? use Tk; require Tk::BrowseEntry; require Tk::ROText; require Tk::NoteBook; my $mw = MainWindow->new( -bg => "#00" ); $frames{main}= $mw->NoteBook(-relief=>'flat',-border=>1,-tabpadx=>1,-tabpady=>1,-font=>[-family=>"Tahoma",-size=>8],-bg=>'#404040',-foreground=>'#FF',-inactivebackground=>"#808080")->pack(-expand => 1,-fill => 'both',-side => 'top'); foreach my $pair (qw/Pair1 Pair2 Pair3 Pair4 Pair5/) { $frames{tab}{$pair}= $frames{main}->add($pair, -label=>$pair); $frames{canvas}{$pair}= $frames{tab}{$pair}->Canvas( -width => 400, -height => 635, -background => 'black',)->pack(-side => 'top'); } $charts{$pair}{grid}{$price} = $frames{canvas}{$pair}->createLine(0,50,615,50, -fill => "#404040"); Compiles ok, but the last code keeps giving me this error: Can't call method "createLine" on an undefined value at chart.pl line 105. If I remove the "Notebook" codes the script runs ok. What I wanted to do is create a TK, create notebooks and each of these "tabs" are canvases where I draw charts. thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Problem with GuiTest FindWindowLike, SetWindowPos
Hi, I am writing a code that will get all IE Windows and sort them from left to right. After so many days, I still could not get this function to properly get the window ID of all Internet Explorer windows: @windows = FindWindowLike(0, "Windows Internet Explorer",0,0,5); @windows = FindWindowLike(0, "Windows Internet Explorer",""); On some cases, I get to get so many IDs (ie, getting 5 IDs for just 2 opened IE Windows). On some cases, I get the right number of IDs (ie, 3 IDs for 3 IE Windows). However, it appears that I am not setting the window's dimension properly - it appears that I am modifying the window within the IE window. Please find below my code. I appreciate your help. thanks Dan my @windows = FindWindowLike(0, "Windows Internet Explorer",0,0,2); #my @windows = FindWindowLike(0, "Windows Internet Explorer", ""); #my @windows = GetActiveWindow(0); my %IE; for my $id (@windows) { my $name = GetWindowText($id); next unless $name =~ /Windows Internet Explorer/; $IE{$id}{name} = $name; ($IE{$id}{x1}, $IE{$id}{y1}, $IE{$id}{x2}, $IE{$id}{y2}) = GetWindowRect($id); } #Sort IE windows according to nearness to the left side my $x; my $WIDTH = 320; foreach my $id (sort {$IE{$a}{x1} <=> $IE{$b}{x1}} keys %IE) { printf "%10d (%d,%d) (%d,%d) %s\n", $id, $IE{$id}{x1}, $IE{$id}{y1}, $IE{$id}{x2}, $IE{$id}{y2}, $IE{$id}{name}; SetWindowPos($id, 0, $x, 0, 320, 700, 0); $x += $WIDTH; } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
finding the window
Hi Is there a way for Perl (GUITest or other modules for that matter) to know that a window is owned by a particular program? Currently, I am using Win32::GUItest my @windows = FindWindowLike(0, program name, undef,0,0); my ($name, $x,$y,$w,$h); for my $id (@windows) { $name = GetWindowText($id); ($x,$y,$w,$h) = GetWindowRect($id); printf "%5d (%d,%d)(%d,%d) %s\n", $id, $x,$y,$w,$h, $name; } However, some programs change their window's name and its difficult/impossible to know if such window is what I am looking for. As an example, Internet Explorer's window title is always the webpage's title. And these webpage titles change as well. What I want is to find that IE browser's window and manipulate (resize/relocate) it. thanks Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
need help with win32:guitest
Hi I need help with Win32 GuiTest. @EXPORT_OK = qw( $debug ClientToScreen FindWindowLike GetChildDepth GetChildWindows GetClassName GetCursorPos GetDesktopWindow GetComboText GetComboContents GetListText GetListContents GetParent GetScreenRes GetWindow GetWindowID GetWindowLong GetWindowRect GetWindowText IsCheckedButton IsChild IsGrayedButton IsWindow MouseMoveAbsPix NormToScreen PostMessage ScreenToClient ScreenToNorm SendKeys SendLButtonDown SendLButtonUp SendMButtonDown SendMButtonUp SendMessage SendMouse SendMouseMoveAbs SendMouseMoveRel SendRButtonDown SendRButtonUp SetForegroundWindow WMGetText EnableWindow GetActiveWindow GetCaretPos GetCursorPos GetFocus GetForegroundWindow IsWindowEnabled IsWindowVisible PostMessage SendMessage SetActiveWindow ShowWindow WMSetText IsKeyPressed PushButton PushChildButton ); I could not find the function that will: 1. return to me the X,Y coordinate of a window 2. resize the window 3. move the window to x,y ie, I need to write a program that will re-arrange all the opened windows by resizing them, and moving to pre-programmed locations. Thanks! Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Perl to move mouse and click
Hi, I want Perl to move the mouse cursor to a particular X,Y coordinate, and then Left Click. How is this done? I appreciate your help. Dan ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs