From: Stuart A. <stu...@at...> - 2003-04-30 20:41:40
|
There is a PM called the Modalizer. It comes with the FRE "The Gui Loft", aka, TGL. Its an interactive design of windows, ie, like VB and VC++ have. With it comes a host of other packages as well. Do you hate to figure out Resizing? Johan (author of TGL) and I believe some work of others as well have a very easy Resizer Object you can use with "typed in" windows development, as well as the Modalizer. For the modalizer, all you need to do is create it, and attach windows. If a minimize is hit, then all windows on it are minimized. When restored, they all come back up. No trick coding or anything! Resizing is fun as well. You can get pretty creative with it (moving controls left, top and by certain degrees!). I'll give you an extreme brief overview here, but best to get TGL (you can google for it) and install and read. Modalizer: Basically you create your windows. I do believe you can add to it if you have dynamic/repeating windows as well. Here's a sniplet (from real code...) I have 4 windows ( $winMain, $winName, $winAddress, $winPhone ). I've created them, and have them hidden (doesn't matter, just a point). So I (obviously) put this at the top: use Win32::GUI::Modalizer; ...create the windows... And the last stop is to do this: my $objModal = Win32::GUI::Modalizer->new( $winMain, $$winName, $winAddress, $winPhone ); Then I have in my main: sub ::winMain_Activate { defined($objModalizer) and $objModalizer->activate($winMain); } (keep the variable global, or whatever to keep it alive!) that handles all of that. As for all the "minimize, maximixe, restore, activate, deactivate" in the "child" windows, I do nothing. I have stubs that just return 0. For resizing, lets say you have a text field( tfNameFirst), and (tfNameLast). You want to have the names stretch by width, but the tfNameLast move to the bottom: Create your window and controls.... Put in the use: use Win32::GUI::Resizer; After the windows are created (and before Dialog/return) add something like this: my $objResizer = Win32::GUI::Resizer->new($winName); # window to resize $objResizer->raRelations([ 'winWidth' => [ ['$winResize->tfNameFirst->Width()'], ['$winResize->tfNameLast->Width()'], ], 'winHeight' => [ ['$winResize->tfNameLast->Top()'], ], ] ); $objResizer->memorize(); then add the function (which you may already have...) sub ::winName_Resize() { my $self = TGL::WindowTool->new(); defined($objResizer) and $objResizer->resize(); return(0); } (keep the variable global, or whatever to keep it alive!) Using just these 2 wonderful things can make your app run much nicer for the use. I have several apps (some fairly large) and they make use of these. But in TGL: You can interactively "feed" these values so you're typing away, rather point-and-click and then in the TGL, you can just test it out!!! Hopefully I didn't have too many typos, but then Outlook looks for misspellings and not compiling code... have fun, -stuart -----Original Message----- From: per...@li... [mailto:per...@li...] On Behalf Of Jeremy White Sent: Wednesday, April 30, 2003 12:58 PM To: da...@es...; per...@li... Subject: RE: [perl-win32-gui-users] Keeping track of child windows The way I dealt with multiple objects with the same name/functionality was to dynamically eval the events into main. Try the below code - it is a hacked job, and can be tidied up, but should give you a few ideas. Cheers, jez. use Win32::GUI; use strict; my $unique; my %resultswindow; for (1..5) { createresults(); } Win32::GUI::Dialog(); sub createresults { #create unique names $unique++; my $windownumber = $unique; my $windowname = "ResultsWin".$windownumber; $unique++; my $butname="Close".$unique; #create the window my $win = new GUI::Window( -title => "Results", -left => 400, -top => 100, -width => 185, -height => 360, -style => WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU , -name => $windowname, ); $resultswindow{$windownumber}=$win; #create the button $win->AddButton( -name => $butname, -text => "Close", -left => 5, -top => 5, -tip => "Click here to close the results view", -cancel => 1, ); $win->Show; my $string='sub ::'.$butname.'_Click {$resultswindow{'.$windownumber.'}->Hide();}'; print $string."\n"; #eval the sub into main eval $string; } >From: "Cruickshanks, Darin" <da...@es...> >To: "Perl-Win32-Gui-Users" <per...@li...> >Subject: RE: [perl-win32-gui-users] Keeping track of child windows >Date: Wed, 30 Apr 2003 17:05:50 +0100 > >Well basically the MainWindow has a button to create a results window >and by design I want it to be able to create more than one window with >results (for camparison etc). > >The new results window is created like this - > >$ResultsWindow = new GUI::Window( > -title => "Results", > -left => 400, > -top => 100, > -width => 185, > -height => 360, > -style => WS_MINIMIZEBOX | WS_CAPTION | WS_SYSMENU , > -name => "ResultsWin", > ); > >I then add a text area and a 'Close' button to this window. > >The close button is added like this - > > $ResultsWindow->AddButton( > -name => "Close", > -text => "Close", > -left => 5, > -top => 5, > -tip => "Click here to close the results view", > -cancel => 1, > ); > > >The subroutine for the click event looks like this - > >sub Close_Click { > $ResultsWindow->Hide(); >} > > >The reason I use hide if because I dont know of a better way of getting >rid of Windows?! > >Clicking the close button then closes the last window created. > >Help? > >Darin > >-------------------------------------------- > >Darin Cruickshanks >Labs Manager, Computing Service >University of Essex >da...@es... >01206 873585 > > -----Original Message----- > From: Garside, Trevor [mailto:tr...@ga...] > Sent: 30 April 2003 14:05 > To: Perl-Win32-Gui-Users > Subject: RE: [perl-win32-gui-users] Keeping track of child windows > > > Can we get some sample code to see how you're handling the window >creation / closing? > > Trevor S Garside > tr...@ga... > > > -----Original Message----- > From: Cruickshanks, Darin [mailto:da...@es...] > Sent: Wednesday, April 30, 2003 8:43 AM > To: Perl-Win32-Gui-Users > Subject: [perl-win32-gui-users] Keeping track of child windows > > > All, > > I have a gui window that can spawn multiple child >windows, each with its own 'Close' button on it. The close button >works fine if there is only one child window but fails to work if there >are more than one. I understand why this is happening but cannot think >of a good way around it! > > Anyone have any ideas or can point out the obvious? > > Cheers, > > > > Darin > > -------------------------------------------- > > Darin Cruickshanks > Labs Manager, Computing Service > University of Essex > da...@es... > 01206 873585 > > -----Original Message----- > From: Peter Eisengrein >[mailto:Pet...@at...] > Sent: 25 April 2003 13:02 > To: Cruickshanks, Darin; Perl-Win32-Gui-Users > Subject: RE: [perl-win32-gui-users] Perl and >printing > > > There may be a better way, but here are two >possible ways: > > ### THIS WILL BRING UP THE SAME PRINT WINDOW AS >USED BY WEB BROWSER > > $dll = "$ENV{'WINDIR'}/System32/mshtml.dll"; > > system("rundll32.exe $dll,PrintHTML $file"); > > > -OR- > > > ### THIS MAY OR MAY NOT GIVE THE BEST RESULTS > > system("copy $file >\\\\ServerName\\PrinterName"); > > > Good luck. > > > -----Original Message----- > From: Cruickshanks, Darin >[mailto:da...@es...] > Sent: Thursday, April 24, 2003 11:12 AM > To: Perl-Win32-Gui-Users; per...@li... > Subject: [perl-win32-gui-users] Perl and >printing > > > All, > > > I have a Perl application that uses >Win32::GUI to provide a nice front end for a database, what I would >really like to do is provide a print feature with the ability to print >to a network printer through the gui. Does anyone know of any way to >do this? > > Cheers, > > Darin > > >-------------------------------------------- > > Darin Cruickshanks > Labs Manager, Computing Service > University of Essex > da...@es... > 01206 873585 > > > _________________________________________________________________ Express yourself with cool emoticons http://www.msn.co.uk/messenger ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |