From: Perl R. <pe...@co...> - 2006-12-21 14:02:45
|
Hi, I'm attempting to place a scrollable text field on top of the background image of my window. Unfortunately, if I add the text field to the window first (i.e. before adding the graphic to the window), then the text field gets "swallowed up" by the graphic, and the only way to see the text field is to mouse over it or click it. If, on the other hand, I add the graphic first, (i.e. before adding the text field), then the text field is properly displayed but frozen--I can't click inside it or scroll it down. I've been searching the Win32-GUI archives and reading the Win32-GUI documentation for several days to no avail, and I've concluded that I just don't understand how to work with graphics. Any advice/education/assistance would be greatly appreciated. Below is an example of my code thus far, which illustrates the "swallowing up" probem. If you move lines 34-49 to line 19, you can see the freezing problem. ############################################# #!c:\perl\bin\perl -w use strict; use Win32::GUI(); use Win32::GUI::DIBitmap(); my $DC; my $main = Win32::GUI::Window->new( -name => 'Main', -width => 799, -height => 577, -text => 'Example... ', -resizable => 0, -hasmaximize => 0, -dialogui => 1, -topmost => 1, ); my $license_agreement_field = $main->AddTextfield( -readonly => 1, -multiline => 1, -name => 'LicenseTextField', -width => 508, -height => 347, -top => 73, -left => 15, -background => [255, 255, 255], -vscroll => 1, ); my $license_agreement_text1 = $license_agreement_field->Append("License agreement goes here..."); $main->AddGraphic ( -name => "Graphic", -pos => [0, 0], -size => [$main->ScaleWidth,$main->ScaleHeight], -interactive => 1, ); my $background = newFromFile Win32::GUI::DIBitmap ('Menu_License_Background.gif'); sub Graphic_Paint { $DC = $main->Graphic->GetDC(); if (defined $background) { $background->CopyToDC($DC); } $DC->Validate(); } $main->Show(); Win32::GUI::Dialog(); ############################################# Thanks in advance, Rob |
From: Steve L. <ste...@sc...> - 2006-12-21 15:07:26
|
*note* I have never used a Graphic object, so I may be wildly off target here :) I had a similar problem when I started looking at layering overlapping buttons. The first "object" to be drawn is the one the system sees first, but the last one to be drawn is the one that is "on top" with the graphics. I ended up having to use the Window_Paint routine to draw my "button" images directly into the background, in the order I wanted them in (and create hotspots with mousedown/mouseup). In your case, you may need to draw your graphics directly into the window DC (So use "window_paint" rather than "graphic_paint", if you see what I mean), then validate the window DC. Dont forget to add this to your window definition: -addstyle => WS_CLIPCHILDREN, -onPaint => \&window_paint, then add your objects (buttons, text boxes, etc) to the window as normal. This might be helpful for you (I hope).... Steve Perl Rob wrote: > Hi, > > I'm attempting to place a scrollable text field on top of the background > image of my window. Unfortunately, if I add the text field to the window > first (i.e. before adding the graphic to the window), then the text > field gets "swallowed up" by the graphic, and the only way to see the > text field is to mouse over it or click it. If, on the other hand, I add > the graphic first, (i.e. before adding the text field), then the text > field is properly displayed but frozen--I can't click inside it or > scroll it down. > > I've been searching the Win32-GUI archives and reading the Win32-GUI > documentation for several days to no avail, and I've concluded that I > just don't understand how to work with graphics. Any > advice/education/assistance would be greatly appreciated. Below is an > example of my code thus far, which illustrates the "swallowing up" > probem. If you move lines 34-49 to line 19, you can see the freezing > problem. > > ############################################# > #!c:\perl\bin\perl -w > > use strict; > use Win32::GUI(); > use Win32::GUI::DIBitmap(); > > my $DC; > > my $main = Win32::GUI::Window->new( > -name => 'Main', > -width => 799, > -height => 577, > -text => 'Example... ', > -resizable => 0, > -hasmaximize => 0, > -dialogui => 1, > -topmost => 1, > ); > > my $license_agreement_field = $main->AddTextfield( > -readonly => 1, > -multiline => 1, > -name => 'LicenseTextField', > -width => 508, > -height => 347, > -top => 73, > -left => 15, > -background => [255, 255, 255], > -vscroll => 1, > ); > > my $license_agreement_text1 = $license_agreement_field->Append("License > agreement goes here..."); > > $main->AddGraphic ( > -name => "Graphic", > -pos => [0, 0], > -size => [$main->ScaleWidth,$main->ScaleHeight], > -interactive => 1, > ); > > my $background = newFromFile Win32::GUI::DIBitmap > ('Menu_License_Background.gif'); > > sub Graphic_Paint { > $DC = $main->Graphic->GetDC(); > if (defined $background) { > $background->CopyToDC($DC); > } > $DC->Validate(); > } > > $main->Show(); > Win32::GUI::Dialog(); > ############################################# > > > Thanks in advance, > Rob > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ------------------------------------------------------------------------ > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ |
From: Brian M. <bmi...@hu...> - 2006-12-22 01:08:28
|
----- Original Message ----- From: "Steve Loughran" <ste...@sc...> To: "Win32 GUI Users Mailing List" <per...@li...> Sent: Thursday, December 21, 2006 10:07 AM Subject: Re: [perl-win32-gui-users] Need help placing controls on top ofgraphics > *note* I have never used a Graphic object, so I may be wildly off target > here :) > > I had a similar problem when I started looking at layering overlapping > buttons. The first "object" to be drawn is the one the system sees > first, but the last one to be drawn is the one that is "on top" with the > graphics. > > I ended up having to use the Window_Paint routine to draw my "button" > images directly into the background, in the order I wanted them in (and > create hotspots with mousedown/mouseup). > > In your case, you may need to draw your graphics directly into the > window DC (So use "window_paint" rather than "graphic_paint", if you see > what I mean), then validate the window DC. Dont forget to add this to > your window definition: > > -addstyle => WS_CLIPCHILDREN, > -onPaint => \&window_paint, > > then add your objects (buttons, text boxes, etc) to the window as normal. > > This might be helpful for you (I hope).... > > Steve > > Perl Rob wrote: >> Hi, >> >> I'm attempting to place a scrollable text field on top of the background >> image of my window. Unfortunately, if I add the text field to the window >> first (i.e. before adding the graphic to the window), then the text >> field gets "swallowed up" by the graphic, and the only way to see the >> text field is to mouse over it or click it. If, on the other hand, I add >> the graphic first, (i.e. before adding the text field), then the text >> field is properly displayed but frozen--I can't click inside it or >> scroll it down. >> >> I've been searching the Win32-GUI archives and reading the Win32-GUI >> documentation for several days to no avail, and I've concluded that I >> just don't understand how to work with graphics. Any >> advice/education/assistance would be greatly appreciated. Below is an >> example of my code thus far, which illustrates the "swallowing up" >> probem. If you move lines 34-49 to line 19, you can see the freezing >> problem. [[ code snipped ]] >> Thanks in advance, >> Rob Steve's method is what I used with Win32::GUI::Skin. Draw the graphic on the DC, and then the objects (with WS_CLIPCHILDREN). Feel free to download Win32::GUI::Skin (at http://win32-gui-skin.sourceforge.net) for ideas. You may even be able to make use in your app of Win32::GUI::Skin (I'd love to find out that someone is actually making use of it!) Brian Millham This message traveled at least 44,000 miles to reach you! Brian, Tommy, Helen and Paka bmi...@hu... |
From: Kind, U. (AGIS) <uwe...@al...> - 2006-12-28 19:23:28
|
Hi Rob, =20 if you use a Label with the "-notify =3D> 0" option to display the = bitmap it should be possible to place other controls on top of it.=20 =20 If you need to catch the events for the background bitmap your in trouble. There seems to be a bug in the event handling for child-controls in Win32::GUI. See also Bug Tracker 1588332. =20 Bye, Uwe ________________________________ Von: per...@li... [mailto:per...@li...] Im Auftrag von Perl Rob Gesendet: Donnerstag, 21. Dezember 2006 15:03 An: Win32 GUI Users Mailing List Betreff: [perl-win32-gui-users] Need help placing controls on top of graphics Hi, =20 I'm attempting to place a scrollable text field on top of the background image of my window. Unfortunately, if I add the text field to the window first (i.e. before adding the graphic to the window), then the text field gets "swallowed up" by the graphic, and the only way to see the text field is to mouse over it or click it. If, on the other hand, I add the graphic first, (i.e. before adding the text field), then the text field is properly displayed but frozen--I can't click inside it or scroll it down. =20 I've been searching the Win32-GUI archives and reading the Win32-GUI documentation for several days to no avail, and I've concluded that I just don't understand how to work with graphics. Any advice/education/assistance would be greatly appreciated. Below is an example of my code thus far, which illustrates the "swallowing up" probem. If you move lines 34-49 to line 19, you can see the freezing problem. =20 ############################################# #!c:\perl\bin\perl -w =20 use strict; use Win32::GUI(); use Win32::GUI::DIBitmap(); =20 my $DC; =20 my $main =3D Win32::GUI::Window->new( -name =3D> 'Main', -width =3D> 799, -height =3D> 577, -text =3D> 'Example... ', -resizable =3D> 0, -hasmaximize =3D> 0, -dialogui =3D> 1, -topmost =3D> 1, ); =20 my $license_agreement_field =3D $main->AddTextfield( -readonly =3D> 1, -multiline =3D> 1, -name =3D> 'LicenseTextField', -width =3D> 508, -height =3D> 347, -top =3D> 73, -left =3D> 15, -background =3D> [255, 255, 255], -vscroll =3D> 1, ); =20 my $license_agreement_text1 =3D = $license_agreement_field->Append("License agreement goes here..."); =20 $main->AddGraphic ( -name =3D> "Graphic", -pos =3D> [0, 0], -size =3D> [$main->ScaleWidth,$main->ScaleHeight], -interactive =3D> 1, ); =20 my $background =3D newFromFile Win32::GUI::DIBitmap ('Menu_License_Background.gif'); =20 sub Graphic_Paint { $DC =3D $main->Graphic->GetDC(); if (defined $background) { $background->CopyToDC($DC); } $DC->Validate(); } =20 $main->Show(); Win32::GUI::Dialog(); ############################################# =20 =20 Thanks in advance, Rob |