Window Background Mask

2005-12-21 Thread Chris Rogers
This is really a two part question.  I'd like to create a grid-like mask for the window background in an efficient manner.  I'd also like that background not to be destroyed when items are moved around in window.  I have the following example code:

 
#!c:/perl58/bin/perl.exe -wuse strict;use Win32::GUI;use constant WM_NCHITTEST => 0x0084;use constant HTCAPTION => 2;

my $window = Win32::GUI::Window->new( -name => 'window1', -text => 'Window 1', -width => 800, -height => 600,
 -dialogui => 1,    );
my $text = $window->AddTextfield( -name => 'text1', -text => 'Text 1', -frame => 1, -left =>10, -top => 10,
 -width => 100, -height => 30,    );$text->Hook(WM_NCHITTEST,sub { $_[0]->Result(HTCAPTION);0;});
$window->Show();
my $DC = $window->GetDC();for (my $x=10;  $x < $window->{-width}; $x += 10){    for (my $y=20;  $y < $window->{-height}; $y += 20)    {    $DC->SetPixel($x,$y);    }}

Win32::GUI::Dialog;
exit(0);
The loop where I create the grid pattern is quite slow ( I can actually see it drawing the dots across the screen ).  There must be some way to create a mask that I can apply to the background instead of manually drawing each dot.  How to do it?

Also, the background gets destroyed when the control is moved around the window.  How do I fix this?
 
Thanks,
Chris 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: How to disable a control without changing appearance

2005-12-20 Thread Chris Rogers
Ok.  I found the constants in WINUSER.h.
On 12/20/05, Chris Rogers <[EMAIL PROTECTED]> wrote:

Cool!!  I was unaware of the Hook method.  
 
Using what you showed me, I can do away with a lot of code that I used to track the mouse and decide whether or not it was currently over a control.  As well as the code I used to move the object around on the screen.  But when I use the hook method for the WM_NCHITTEST message, I can't respond to click events the way I would like.  

 
As I understand it now, I can set multiple Hooks for one message as well as different hooks for different messages.  I think I have found a pretty good list of messages and return values on msdn but I can't find the values for the constants.  

 
In all the docs I've looked at, I haven't found on that told me that WM_NCHITTEST = 132 or HTCAPTION = 2.  Can you tell me where to find the actual values for the constants? 
Thanks,
Chris

 
On 12/20/05, May, Robert <[EMAIL PROTECTED]> wrote:
 
Chris Rogers wrote:[snip]> The whole idea is to be able to use the mouse to grab> any control on a given Win32::GUI window and drag it 
> to a new location.  Sort of a gui designer.Apologies for my first response, I completely mis-understoodWhat you were trying to do.Is this better?  Look at MSDN documentation for WM_NCHITTEST
and then ask here if you need an explanation of how/why thisworks:#!perl -wuse strict;use warnings;use Win32::GUI();# Constantssub WM_NCHITTEST() {132}sub HTCAPTION()  {2}
my $mw = Win32::GUI::Window->new(   -title => "Designer",   -pos => [100,100],   -size => [400,300],);$mw->AddTextfield(   -size => [100,100],
   -multiline => 1,   -text => 'Left mouse to drag',)->Hook(   WM_NCHITTEST,   sub { $_[0]->Result(HTCAPTION); 0;});$mw->Show();Win32::GUI::Dialog();exit(0); 
__END__Regards,Rob.=This email message and any attachments thereto are intended only for use by the addressee(s) named above, and may contain legally privileged and/or confidential information. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the 
[EMAIL PROTECTED] and destroy the original message

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: How to disable a control without changing appearance

2005-12-20 Thread Chris Rogers
Cool!!  I was unaware of the Hook method.  
 
Using what you showed me, I can do away with a lot of code that I used to track the mouse and decide whether or not it was currently over a control.  As well as the code I used to move the object around on the screen.  But when I use the hook method for the WM_NCHITTEST message, I can't respond to click events the way I would like. 

 
As I understand it now, I can set multiple Hooks for one message as well as different hooks for different messages.  I think I have found a pretty good list of messages and return values on msdn but I can't find the values for the constants.  

 
In all the docs I've looked at, I haven't found on that told me that WM_NCHITTEST = 132 or HTCAPTION = 2.  Can you tell me where to find the actual values for the constants? 
Thanks,
Chris
 
On 12/20/05, May, Robert <[EMAIL PROTECTED]> wrote:
Chris Rogers wrote:[snip]> The whole idea is to be able to use the mouse to grab> any control on a given Win32::GUI window and drag it
> to a new location.  Sort of a gui designer.Apologies for my first response, I completely mis-understoodWhat you were trying to do.Is this better?  Look at MSDN documentation for WM_NCHITTEST
and then ask here if you need an explanation of how/why thisworks:#!perl -wuse strict;use warnings;use Win32::GUI();# Constantssub WM_NCHITTEST() {132}sub HTCAPTION()  {2}
my $mw = Win32::GUI::Window->new(   -title => "Designer",   -pos => [100,100],   -size => [400,300],);$mw->AddTextfield(   -size => [100,100],
   -multiline => 1,   -text => 'Left mouse to drag',)->Hook(   WM_NCHITTEST,   sub { $_[0]->Result(HTCAPTION); 0;});$mw->Show();Win32::GUI::Dialog();exit(0);
__END__Regards,Rob.=This email message and any attachments thereto are intended only for use by the addressee(s) named above, and may contain legally privileged and/or confidential information. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the 
[EMAIL PROTECTED] and destroy the original message
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [aswin32] Re: How to disable a control without changing appearance

2005-12-19 Thread Chris Rogers
Point taken on the default assumption of what this list is about.  
 
Thanks for the tip on the background color.  It appears that the changing appearance is handled directly by the OS when we send it a message to disable the control.  It also appears that the two parts of the process WM_DISABLE and WM_PAINT are not easily seperated. 

 
Perhaps there is a better way to do this.  The whole idea is to be able to use the mose to grab any control on a given Win32::GUI window and drag it toa new location.  Sort of a gui designer.  I know this has been done but I'll learn more by doing it again.  I've worked out all the kinks except most that controls must be disabled in order to grab them with the mouse.  Or at least this is the case using my code.  It's probably broken.  The thing is that if the objects are disabled, I can't really tell myself I've created a wysisyg window designer.

 
Thanks,
Chris
 
 
On 12/19/05, Lynn. Rickards <[EMAIL PROTECTED]> wrote:
Chris Rogers wrote:> Sorry, about the lack of information in my original post.  I just> assumed, this being a perl-win32 group that Win32::GUI was a given.
> I'll try to be more specific in the future.>> I tried $control->Enable(0) but the control still gets greyed out.  I'm> using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp.  Here's a
> brief example:>> #!c:\perl58\bin\wperl.exe -W> use strict;> use Win32::GUI;> use Win32::API;>> our $mainform = Win32::GUI::Window->new(>   -name=>'main',
>   -text=>'main',>   -width=>800,-height=>600,> ) or die "window creation
> failed: $!\n";>> our $test = $mainform->AddTextfield(> -name=>'test',> -text=>'test',> -left=>200,-top=>200,
> -width=>100,-height=>20,>);> $test->Enable(0);> $mainform->Show();> Win32::GUI::Dialog;>> I also tried to set the onClick event to an empty sub which didn't work
> either>> our $test = $mainform->AddTextfield(> -name=>'test',> -text=>'test',>     -left=>200,-top=>200,
> -width=>100,-height=>20,> ->>);>> On 12/18/05, *Robert May* <
[EMAIL PROTECTED]> [EMAIL PROTECTED]>> wrote:>> Lynn. Rickards wrote:
>  > Chris Rogers wrote:>  >>  >> I'm looking for a way to disable a control (widget) without> changing>  >> it's appearance.  I would like to be able to do this for any type of
>  >> control.  Any help would be greatly appreciated.>  >>>  >> Thanks,>  >> Chris>  >>>  > Tk? Win32? Either way, what comes to mind instead of disabling,
>  > is configuring/binding to an empty sub.>> For Win32::GUI use>   $control->Enable(0);>> Regards,> Rob.OK, I'm no Win32::Gui expert, and by the way, Tk is part of the ASperl
distro, while Win32::Gui isn't...but don't let's fight over which shouldbe the default assumption in the list ;-)I had assumed you were looking to render a button-based widget inactive.Since it is a text widget that (in win32-gui) doesn't seem to respond to
mouseclick events, we need to handle it differently.Since calling $textbox->Enable(); and $textbox->Disable(); changes thecolors, you would want to fix the colors. I find that adding:   -background ="" [255, 255, 255],
...to AddTextfield() will hold the background white in both states.However, -foreground is overridden when the widget is disabled, and textis slightly grayed.I failed to find anything like Tk's $widget->configure() in the
win32-gui docs - anyone?Half an answer, anyhow...HTH - Lynn.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [aswin32] Re: How to disable a control without changing appearance

2005-12-18 Thread Chris Rogers
Sorry, about the lack of information in my original post.  I just assumed, this being a perl-win32 group that Win32::GUI was a given.  I'll try to be more specific in the future.
 
I tried $control->Enable(0) but the control still gets greyed out.  I'm using activestate perl 5.8.7 and Win32::GUI 1.03 on win xp.  Here's a brief example:
 
#!c:\perl58\bin\wperl.exe -Wuse strict;use Win32::GUI;use Win32::API;

our $mainform = Win32::GUI::Window->new(  -name=>'main',  -text=>'main',  -width=>800,-height=>600,
    ) or die "window creation failed: $!\n";
our $test = $mainform->AddTextfield(    -name=>'test',    -text=>'test',    -left=>200,-top=>200,
    -width=>100,-height=>20,   );$test->Enable(0);$mainform->Show();Win32::GUI::Dialog;
I also tried to set the onClick event to an empty sub which didn't work either
 
our $test = $mainform->AddTextfield(    -name=>'test',    -text=>'test',    -left=>200,-top=>200,
    -width=>100,-height=>20,    ->   ); 
On 12/18/05, Robert May <[EMAIL PROTECTED]> wrote:
Lynn. Rickards wrote:> Chris Rogers wrote:>>> I'm looking for a way to disable a control (widget) without changing
>> it's appearance.  I would like to be able to do this for any type of>> control.  Any help would be greatly appreciated.>>>> Thanks,>> Chris>>> Tk? Win32? Either way, what comes to mind instead of disabling,
> is configuring/binding to an empty sub.For Win32::GUI use  $control->Enable(0);Regards,Rob.___Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.comTo 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


How to disable a control without changing appearance

2005-12-17 Thread Chris Rogers
I'm looking for a way to disable a control (widget) without changing it's appearance.  I would like to be able to do this for any type of control.  Any help would be greatly appreciated.
 
Thanks,
Chris
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: [aswin32] MDI Windows and Icons

2005-12-17 Thread Chris Rogers
Rob,
 
Thanks for the quick answer.  I don't know how I missed the "SetIcon" method.  Thanks also for the info on subclassing.  
 
Chris 
 
 
On 12/16/05, Robert May <[EMAIL PROTECTED]> wrote:
Chris Rogers wrote:> I have been trying to set an icon for an MDIFrame.  I also need to set> different icons for the Child windows.  I am using Win32::GUI 
1.03 with> Activestate 5.8.7 along with Komodo and Perlapp.  In the past, I could> never get the "-icon=>$icon" to workThere is, as far as I can see from the documentation and the source code
no such '-icon' option for windows.> so I had to use Win32::GUI::Class> to set the window icon and that seemed to work just fine.That's one way to do it.  $window->SetIcon($icon) is another (and in
this case probably simpler).[snip]> *my $icon = new Win32::GUI::Icon("c:\\JS1G.ICO");> my $WC = new Win32::GUI::Class(-name => "mywindowclass", -icon =>> $icon,);*
You need to subclass the relevant widget class.  This would work:my $WC = WIn32::GUI::Class->new(  -name => "MyMDIFrameSubClass",  -icon => $icon  -widget => 'MDIFrame',
);[ snip ]> In short: How do I set one icon for an MDIFrame and different icons for> MDIChild windows??Here's the 2 ways to do it:#!perl -wuse strict;use warnings;
use Win32::GUI;my $icon = new Win32::GUI::Icon("c:\\JS1G.ICO");my $mw = Win32::GUI::MDIFrame->new(   -text   => 'Main Window',   -width  => 1024,   -height => 768,
) or die "frame creation failed: [EMAIL PROTECTED]";$mw->SetIcon($icon);my $mc = $mw->AddMDIClient(   -firstchild => 100,) or die "client creation failed: [EMAIL PROTECTED]";
my $cw = $mc->AddMDIChild(   -name => 'window1',   -text => 'Window1',   -pos  => [100, 100],   -size => [810, 610],) or die "child creation failed: [EMAIL PROTECTED]";
$cw->SetIcon($icon);$mw->Show();Win32::GUI::Dialog();exit(0);__END__#!perl -wuse strict;use warnings;use Win32::GUI;my $icon = new Win32::GUI::Icon("c:\\JS1G.ICO");
my $frame_class = new Win32::GUI::Class(   -name   => "mywindowclass",   -icon   => $icon,   -widget => "MDIFrame",   # use the MDIFrame windowproc);
my $child_class = new Win32::GUI::Class(   -name   => "mychildwindowclass",   -icon   => $icon,   -widget => "MDIChild",   # use the MDIChild windowproc);
my $mw = Win32::GUI::MDIFrame->new(   -text  => 'Main Window',   -size  => [1024,768],   -class => $frame_class,) or die "frame creation failed: [EMAIL PROTECTED]";my $mc = $mw->AddMDIClient(
   -firstchild => 100,) or die "client creation failed: [EMAIL PROTECTED]";my $cw = $mc->AddMDIChild(   -name  => 'window1',   -text  => 'Window1',   -pos   => [100, 100],
   -size  => [810, 610],   -class => $child_class,) or die "child creation failed: [EMAIL PROTECTED]";$mw->Show();Win32::GUI::Dialog();exit(0);__END__As an aside a complete but minimal example showing your problem is
preferable so that it's quick and easy to run it, and so that we don'thave to work out what else we need to add in order to get your code to run.Regards,Rob.--Robert MayWin32::GUI, a perl extension for native Win32 applications
http://perl-win32-gui.sourceforge.net/
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


MDI Windows and Icons

2005-12-16 Thread Chris Rogers
I have been trying to set an icon for an MDIFrame.  I also need to set different icons for the Child windows.  I am using Win32::GUI 1.03 with Activestate 5.8.7 along with Komodo and Perlapp.  In the past, I could never get the "-icon=>$icon" to work so I had to use Win32::GUI::Class to set the window icon and that seemed to work just fine.

 


my $icon = new Win32::GUI::Icon("c:\\JS1G.ICO");my $windowclass = new Win32::GUI::Class(-name => "mywindowclass", -icon => $icon,);
our $mainform = Win32::GUI::Window->new(  -name=>'mainwindow',  -text=>'Main Window',  -width=>1024,
  -height=>768,  -class=>$WC,   ) or die "window creation failed: $!\n";

 
But this causes another issue when using MDIFrame and MDIChild.  Using the same technique as above with MDIFrame, I get the icon but the background of the frame window changes and I never see the Child window.

 


my $icon = new Win32::GUI::Icon("c:\\JS1G.ICO");my $WC = new Win32::GUI::Class(-name => "mywindowclass", -icon => $icon,);

our $mainform = Win32::GUI::MDIFrame->new(  -name=>'mainwindow',  -text=>'Main Window',  -width=>1024,
  -height=>768,  -class=>$WC,   ) or die "frame creation failed: [EMAIL PROTECTED]";

our $mainclient = $mainform->AddMDIClient( -name=>'designer_client', -firstchild=>100,    ) or die "client creation failed: [EMAIL PROTECTED]";

$childwindow = $mainclient->AddMDIChild(   -name=>'window1',-text=>'Window1',   -width=>810, -height=>610,
   -top=>100, -left=>100,   -dialogui=>1,   -accel=>$accelerators,
   -menu=>$mainmenu,#   -class=>$WC,   -icon => $icon,
  ) or die "child creation failed: [EMAIL PROTECTED]";
Using the "-class" option (commented out above) in the child window causes a gpf type failure: 
Perl Command Line Interpreter has encountered a problem and needs to close. We are sorry for the inconvenience.
and the "-icon" option does nothing.  
 
I get the same behaviour using Win32::GUI 1.0 with Perl 5.6.
 
In short: How do I set one icon for an MDIFrame and different icons for MDIChild windows??
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: reading "file info" of a ms word document

2005-07-14 Thread Chris Rogers
Perhaps this link:
http://user.cs.tu-berlin.de/~schwartz/pmh/

On 7/14/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> oops...  wrong link.  sorry
> 
> On 7/14/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> > Check out this webpage, it might help:
> > http://user.cs.tu-berlin.de/~schwartz/pmh/ldat-out.html
> >
> >
> > On 7/14/05, Tom Beissler <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > i am looking for a way to read the extended properties from a MS Winword
> > > document such as "author", "version", or "company".
> > > Is there any perl module that can read this information from this file? I
> > > haven´t found anything by googleing the web.
> > > Any suggestions?
> > >
> > > lg,
> > >
> > >
> > >
> > >
> > > Thomas Beissler
> > >
> > > Administration und Projektmanagement
> > >
> > >
> > >
> > > ___
> > > 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: reading "file info" of a ms word document

2005-07-14 Thread Chris Rogers
oops...  wrong link.  sorry

On 7/14/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> Check out this webpage, it might help:
> http://user.cs.tu-berlin.de/~schwartz/pmh/ldat-out.html
> 
> 
> On 7/14/05, Tom Beissler <[EMAIL PROTECTED]> wrote:
> > Hi,
> > i am looking for a way to read the extended properties from a MS Winword
> > document such as "author", "version", or "company".
> > Is there any perl module that can read this information from this file? I
> > haven´t found anything by googleing the web.
> > Any suggestions?
> >
> > lg,
> >
> >
> >
> >
> > Thomas Beissler
> >
> > Administration und Projektmanagement
> >
> >
> >
> > ___
> > 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: reading "file info" of a ms word document

2005-07-14 Thread Chris Rogers
Check out this webpage, it might help:
http://user.cs.tu-berlin.de/~schwartz/pmh/ldat-out.html


On 7/14/05, Tom Beissler <[EMAIL PROTECTED]> wrote:
> Hi,
> i am looking for a way to read the extended properties from a MS Winword
> document such as "author", "version", or "company".
> Is there any perl module that can read this information from this file? I
> haven´t found anything by googleing the web.
> Any suggestions?
>  
> lg,
> 
> 
>  
> 
> Thomas Beissler
> 
> Administration und Projektmanagement
> 
>  
>  
> ___
> 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: Problems with Win32::GUI::Brush / Pen

2005-07-12 Thread Chris Rogers
I did look at it.  It turns out that the problem was trying to use the
GetDC method inline.

$ChildWin->GetDC->SelectObject($dragpen)

When I assigned the DC to a variable and used the variable instead

my $DCC = $ChildWin->GetDC();
$DCC->SelectObject($dragpen);

everything works just fine.  It doesn't make much sense to me why it
happens this way but at least now I know how to make it work.  I guess
that's what I get for taking shortcuts.

Thanks,
Chris

PS:  Also, I would like to apologize to the list for double posting. 
My first post didn't show up for about 8 hours so I thought something
went wrong.  As far as I can tell, the second post still hasn't shown
up but it probably will.  Again, sorry for being impatient.

On 7/11/05, Sisyphus <[EMAIL PROTECTED]> wrote:
> 
> - Original Message -
> From: "Chris Rogers" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, July 12, 2005 4:16 AM
> Subject: Problems with Win32::GUI::Brush / Pen
> 
> 
> > I have been playing around with samples/BitmapScroll.pl from the
> > Win32-GUI-1.0 source using perl 5.6 on WinXP SP2.  I can't seem to get
> > a Brush or Pen working for me.  No matter what I do (so far), the
> > rectangle is drawn with the brush/pen I think I'm specifying.  Here's
> > a sample of my broken code:
> >
> 
> 'samples/Draw.pl' (in the source distro) uses Brush and Pen. I imagine
> you've checked it out already - but if you haven't, then it might help.
> 
> Cheers,
> Rob
> 
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Problems with Win32::GUI::Brush and PEN

2005-07-11 Thread Chris Rogers
I have been playing around with samples/BitmapScroll.pl from the
Win32-GUI-1.0 source using perl 5.6 on WinXP SP2.  I can't seem to get
a Brush or Pen working for me.  No matter what I do (so far), the
rectangle is drawn with the brush/pen I think I'm specifying.  The
majority of this code is straight from the BtimapScroll.pl sample.

use Win32::GUI;
use strict;


#create a new class which stops the WM_ERASEBKGND message from erasing
the background
#this stops the flicker of the window on resize.
my $WC = new Win32::GUI::Class(
-name => "NoFlicker", 
-style => 0,
);

#Create the window and child controls.
my $mainwin = new Win32::GUI::Window (
-pos => [100, 100],
-size=> [330, 235],
-name=> "Window",
-text=> "Bitmap Scroll demo",
-pushstyle   => WS_CLIPCHILDREN,
-class   => $WC,
#NEM Events for this window
-onResize=> \&MainResize,
-onTerminate => sub {return -1;}
);

$mainwin->AddButton (
-name=> 'Open',
-pos => [205, 20],
-size=> [110, 20],
-text=> 'Open Bitmap',
-onClick => \&FindAndOpenBitmap,
);

#Define global variables
my $memdc;
my $bitmap;#will hold the bitmap
###
#   my brush and pen objects
our $dragpen = Win32::GUI::Pen->new(-color=>[0,255,0],-width=>5);
our $dragbrush = Win32::GUI::Brush->new(-color=>[0,0,255]);
###

#Create a child window with a scroll bars. 
my $ChildWin = new Win32::GUI::Window (
-parent  => $mainwin,
-name=> "ChildWin",
-pos => [0, 0],
-size=> [200, 200],
-popstyle=> WS_CAPTION | WS_SIZEBOX,
-pushstyle   => WS_CHILD | WS_CLIPCHILDREN,
-pushexstyle => WS_EX_CLIENTEDGE,
-class   => $WC,
-hscroll => 1,
-vscroll => 1,
-onScroll=> \&Scroll,
-onResize=> sub {&Resize($bitmap,@_)},
-onPaint => sub {&Paint($memdc,@_)},
-onMouseDown => \&MouseDown,
-onMouseUp   => \&MouseUp,
-onMouseMove => \&MouseMove,
-interactive => 1,
);

#Create a memory DC compatible with the child window DC
$memdc=$ChildWin->GetDC->CreateCompatibleDC();

#show both windows and enter the Dialog phase.
$mainwin->Show();
$ChildWin->Show();


# my attempt at a rectangle
$ChildWin->SelectObject($dragpen);
$ChildWin->SelectObject($dragbrush);
$ChildWin->GetDC->Rectangle(10,10,50,50);
$ChildWin->GetDC->Validate();


Win32::GUI::Dialog();

The window displays with no errors.  The rectangle is drawn with a
thin black border and a white background.  I was expecting a thick
green border with a blue background.  What am I doing wrong?

Thanks,
Chris

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Problems with Win32::GUI::Brush / Pen

2005-07-11 Thread Chris Rogers
I have been playing around with samples/BitmapScroll.pl from the
Win32-GUI-1.0 source using perl 5.6 on WinXP SP2.  I can't seem to get
a Brush or Pen working for me.  No matter what I do (so far), the
rectangle is drawn with the brush/pen I think I'm specifying.  Here's
a sample of my broken code:

use Win32::GUI;
use strict;

###
#   my brush and pen objects
our $dragpen = Win32::GUI::Pen->new(-color=>[0,255,0],-width=>5);
our $dragbrush = Win32::GUI::Brush->new(-color=>[0,0,255]);
###

#create a new class which stops the WM_ERASEBKGND message from erasing
the background
#this stops the flicker of the window on resize.
my $WC = new Win32::GUI::Class(
-name => "NoFlicker", 
-style => 0,
);

#Create the window and child controls.
my $mainwin = new Win32::GUI::Window (
-pos => [100, 100],
-size=> [330, 235],
-name=> "Window",
-text=> "Bitmap Scroll demo",
-pushstyle   => WS_CLIPCHILDREN,
-class   => $WC,
#NEM Events for this window
-onResize=> \&MainResize,
-onTerminate => sub {return -1;}
);

$mainwin->AddButton (
-name=> 'Open',
-pos => [205, 20],
-size=> [110, 20],
-text=> 'Open Bitmap',
-onClick => \&FindAndOpenBitmap,
);

#Define global variables
my $memdc;
my $bitmap;#will hold the bitmap

#Create a child window with a scroll bars. 
my $ChildWin = new Win32::GUI::Window (
-parent  => $mainwin,
-name=> "ChildWin",
-pos => [0, 0],
-size=> [200, 200],
-popstyle=> WS_CAPTION | WS_SIZEBOX,
-pushstyle   => WS_CHILD | WS_CLIPCHILDREN,
-pushexstyle => WS_EX_CLIENTEDGE,
-class   => $WC,
-hscroll => 1,
-vscroll => 1,
-onScroll=> \&Scroll,
-onResize=> sub {&Resize($bitmap,@_)},
-onPaint => sub {&Paint($memdc,@_)},
-onMouseDown => \&MouseDown,
-onMouseUp   => \&MouseUp,
-onMouseMove => \&MouseMove,
-interactive => 1,
);

#Create a memory DC compatible with the child window DC
$memdc=$ChildWin->GetDC->CreateCompatibleDC();


#show both windows and enter the Dialog phase.
$mainwin->Show();
$ChildWin->Show();


# my attempt at a rectangle
$ChildWin->SelectObject($dragpen);
$ChildWin->SelectObject($dragbrush);
$ChildWin->GetDC->Rectangle(10,10,50,50);
$ChildWin->GetDC->Validate();


Win32::GUI::Dialog();


The rectangle is drawn but with a single pixel black border and white
background.  I was expecting a thick green border with a blue
background.  What am I doing wrong?

Thanks,
 Chris

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::GUI::Label, Bitmaps, and Resizing

2005-07-07 Thread Chris Rogers
It's a timing issue.  I need to know whether the user has clicked the
mouse button as a single click, double click, or holding it down for
dragging.  I have looked for something that will return the state of
the mouse buttons but all I could find was Win32::Console and that
just doesn't seem to be what I was looking for.  I'm still working on
the details of implementing it and would be glad to hear other
suggestions.

On 7/6/05, Sisyphus <[EMAIL PROTECTED]> wrote:
> 
> - Original Message -
> From: "Chris Rogers" <[EMAIL PROTECTED]>
> To: "Glenn Linderman" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>; 
> Sent: Thursday, July 07, 2005 6:34 AM
> Subject: Re: Win32::GUI::Label, Bitmaps, and Resizing
> 
> 
> > Thanks again.  After a little more research, I came up with the
> > following which I am still working on.  I'll be using the GetTickCount
> > so that I can tell if the user clicked, double-clicked or began to
> > drag the mouse.
> 
> Afaik, Win32::GetTickCount() returns the number of milliseconds elapsed
> since the last system boot . nothing more, nothing less. I don't see how
> it can help you.
> 
> Cheers,
> Rob
> 
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::GUI::Label, Bitmaps, and Resizing

2005-07-06 Thread Chris Rogers
Thanks again.  After a little more research, I came up with the
following which I am still working on.  I'll be using the GetTickCount
so that I can tell if the user clicked, double-clicked or began to
drag the mouse.  With a little luck and the help of you guys on this
list, I might just end up with a working model in a week or so.

sub MouseMove
{
if($mouseisdown == 1)
{
print "Moving: " . (join "," , GetMouseXY()) . "\n";
}
}

sub MouseDown
{
$mouseisdown=1;
$mousedownticks = Win32::GetTickCount();
($mouseisdownx,$mouseisdowny) = GetMouseXY();
#print $mousedownticks;
print "MouseDown " . (join "," , ($mouseisdownx,$mouseisdowny)) . "\n";
}
sub MouseUp
{
$mouseisdown=0;
$mouseupticks = Win32::GetTickCount();
#print ($mouseupticks - $mousedownticks);
($mouseisupx,$mouseisupy) = GetMouseXY();
print "MouseUp " . (join "," , ($mouseisupx,$mouseisupy)) . "\n";
}

sub GetMouseXY
{
my ($x,$y) = $ChildWin->ScreenToClient(Win32::GUI::GetCursorPos);
return ($x, $y);
}


On 7/6/05, Glenn Linderman <[EMAIL PROTECTED]> wrote:
> 
> 
> On approximately 7/6/2005 7:52 AM, came the following characters from
> the keyboard of Chris Rogers:
> > Thanks for the info.  It works perfectly.  Too bad the ppm I installed
> > didn't include the samples.
> >
> > I was able to get the mouse coordinates using:
> > my $GetMouseCoord = new Win32::API('user32', 'GetCursorPos', 'P', 'V');
> > my $point = pack('LL', 0, 0);
> > $GetMouseCoord->Call($point);
> > my ($x, $y) = unpack('LL', $point);
> 
> my ( $x, $y ) = Win32::GUI::GetCursorPos();
> 
> might do that trick in fewer lines... and it might be window relative...
> 
> > Now I just have to get the coordinates of the mainwindow,childwindow,
> > and bitmap so I can make the mouse coordinates relative to the bitmap
> > instead of the screen.
> 
> Look at $window->GetWindowRect();
> 
> > Thanks again,
> > Chris
> >
> >
> > On 7/6/05, Glenn Linderman <[EMAIL PROTECTED]> wrote:
> >
> >>[Questions about Win32::GUI might be found and responded to faster on
> >>the perl-win32-gui-users list on sourceforge.net.]
> >>
> >>On approximately 7/5/2005 7:19 PM, came the following characters from
> >>the keyboard of Chris Rogers:
> >>
> >>
> >>>UPDATE:
> >>>
> >>>The more I look at this problem, the more worried I get.  I'll explain
> >>>the desired end result in a little more detail so you guys can tell me
> >>>if I'm barking up the wrong tree.
> >>>
> >>>1)  I need to be able to display a large image in a smaller container
> >>>and allow the user to scroll the image in the container.
> >>
> >>There is some nice sample code Jez White contributed and I massaged a
> >>bit to make more generic, in the source tree for Win32::GUI
> >>samples/BitmapScroll.pl   It solves this problem nicely.
> >>
> >>
> >>>2)  I need to be able to capture the xy coordinates relative to the
> >>>image when the user clicks the mouse.
> >>>3)  I need to be able to capture the xy coordinates relative to the
> >>>image when the user presses the mouse button as well as the
> >>>coordinates when the user releases the button.
> >>
> >>I haven't needed these myself, but there are mousedown and mouseup sorts
> >>of events for windows, as well as click, so I think it should work.
> >>
> >>
> >>>The big picture:
> >>>I would like to display an image and allow the user to click and drag
> >>>to define areas in the image.  I will store the defined area and allow
> >>>the user to give it a name, description and either a destination image
> >>>or select a list of assets that reside in that area.  That way when
> >>>the user clicks a defined area, a new image or the inventory list can
> >>>be displayed.
> >>>
> >>>It sounds like a simple task but I'm just not sure if there is a way
> >>>to do this in Win32::GUI.  I thought the label control would work but
> >>>I'm not even sure that it responds to the Click event.
> >>
> >>Labels are pretty limited.  I was using them in despair until Jez showed
> >>me the way...
> >>
> >>
> >>>Please feel free to tell me if I'm crazy but there has to be a way to do 
> >>&

Re: Win32::GUI::Label, Bitmaps, and Resizing

2005-07-06 Thread Chris Rogers
Thanks for the info.  It works perfectly.  Too bad the ppm I installed
didn't include the samples.

I was able to get the mouse coordinates using:
my $GetMouseCoord = new Win32::API('user32', 'GetCursorPos', 'P', 'V');
my $point = pack('LL', 0, 0); 
$GetMouseCoord->Call($point);
my ($x, $y) = unpack('LL', $point);

Now I just have to get the coordinates of the mainwindow,childwindow,
and bitmap so I can make the mouse coordinates relative to the bitmap
instead of the screen.

Thanks again,
Chris


On 7/6/05, Glenn Linderman <[EMAIL PROTECTED]> wrote:
> [Questions about Win32::GUI might be found and responded to faster on
> the perl-win32-gui-users list on sourceforge.net.]
> 
> On approximately 7/5/2005 7:19 PM, came the following characters from
> the keyboard of Chris Rogers:
> 
> > UPDATE:
> >
> > The more I look at this problem, the more worried I get.  I'll explain
> > the desired end result in a little more detail so you guys can tell me
> > if I'm barking up the wrong tree.
> >
> > 1)  I need to be able to display a large image in a smaller container
> > and allow the user to scroll the image in the container.
> 
> There is some nice sample code Jez White contributed and I massaged a
> bit to make more generic, in the source tree for Win32::GUI
> samples/BitmapScroll.pl   It solves this problem nicely.
> 
> > 2)  I need to be able to capture the xy coordinates relative to the
> > image when the user clicks the mouse.
> > 3)  I need to be able to capture the xy coordinates relative to the
> > image when the user presses the mouse button as well as the
> > coordinates when the user releases the button.
> 
> I haven't needed these myself, but there are mousedown and mouseup sorts
> of events for windows, as well as click, so I think it should work.
> 
> > The big picture:
> > I would like to display an image and allow the user to click and drag
> > to define areas in the image.  I will store the defined area and allow
> > the user to give it a name, description and either a destination image
> > or select a list of assets that reside in that area.  That way when
> > the user clicks a defined area, a new image or the inventory list can
> > be displayed.
> >
> > It sounds like a simple task but I'm just not sure if there is a way
> > to do this in Win32::GUI.  I thought the label control would work but
> > I'm not even sure that it responds to the Click event.
> 
> Labels are pretty limited.  I was using them in despair until Jez showed
> me the way...
> 
> > Please feel free to tell me if I'm crazy but there has to be a way to do 
> > this.
> >
> > Thanks,
> > Chris
> >
> > On 7/5/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> >
> >>Is there a way to keep a label from resizing itself and the bitmap?
> >>
> >>Here's the scenario:
> >>I want to use a label that is 400x400 to hold a bitmap whose
> >>dimensions are unknown and use scroll bars to move the image around if
> >>the image is larger than the label.  The need here is to be able to
> >>display very large images without distortion and allow the user to
> >>move around in the image.
> >>
> >>Adding the scroll bars to the label is easy enough using
> >>   -addstyle=3D>WS_VSCROLL|WS_HSCROLL
> >>but everything I have tried has resized either the label or the bitmap.
> >>
> >>Perhaps I am going about this the wrong way and am open to to other 
> >>suggestions.
> >>
> >>Thanks,
> >>Chris
> >>
> >
> >
> > ___
> > Perl-Win32-Users mailing list
> > Perl-Win32-Users@listserv.ActiveState.com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> >
> >
> >
> >
> 
> --
> Glenn -- http://nevcal.com/
> ===
> Having identified a vast realm of ignorance, Wolfram is saying that much
> of this realm lies forever outside the light cone of human knowledge.
>   -- Michael Swaine, Dr Dobbs Journal, Sept 2002
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Win32::GUI::Label, Bitmaps, and Resizing

2005-07-05 Thread Chris Rogers
UPDATE:

The more I look at this problem, the more worried I get.  I'll explain
the desired end result in a little more detail so you guys can tell me
if I'm barking up the wrong tree.

1)  I need to be able to display a large image in a smaller container
and allow the user to scroll the image in the container.
2)  I need to be able to capture the xy coordinates relative to the
image when the user clicks the mouse.
3)  I need to be able to capture the xy coordinates relative to the
image when the user presses the mouse button as well as the
coordinates when the user releases the button.

The big picture:
I would like to display an image and allow the user to click and drag
to define areas in the image.  I will store the defined area and allow
the user to give it a name, description and either a destination image
or select a list of assets that reside in that area.  That way when
the user clicks a defined area, a new image or the inventory list can
be displayed.

It sounds like a simple task but I'm just not sure if there is a way
to do this in Win32::GUI.  I thought the label control would work but
I'm not even sure that it responds to the Click event.

Please feel free to tell me if I'm crazy but there has to be a way to do this.

Thanks,
Chris

On 7/5/05, Chris Rogers <[EMAIL PROTECTED]> wrote:
> Is there a way to keep a label from resizing itself and the bitmap?
> 
> Here's the scenario:
> I want to use a label that is 400x400 to hold a bitmap whose
> dimensions are unknown and use scroll bars to move the image around if
> the image is larger than the label.  The need here is to be able to
> display very large images without distortion and allow the user to
> move around in the image.
> 
> Adding the scroll bars to the label is easy enough using
>-addstyle=3D>WS_VSCROLL|WS_HSCROLL
> but everything I have tried has resized either the label or the bitmap.
> 
> Perhaps I am going about this the wrong way and am open to to other 
> suggestions.
> 
> Thanks,
> Chris
>

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Win32::GUI::Label, Bitmaps, and Resizing

2005-07-05 Thread Chris Rogers
Is there a way to keep a label from resizing itself and the bitmap?

Here's the scenario:
I want to use a label that is 400x400 to hold a bitmap whose
dimensions are unknown and use scroll bars to move the image around if
the image is larger than the label.  The need here is to be able to
display very large images without distortion and allow the user to
move around in the image.

Adding the scroll bars to the label is easy enough using
-addstyle=3D>WS_VSCROLL|WS_HSCROLL
but everything I have tried has resized either the label or the bitmap.

Perhaps I am going about this the wrong way and am open to to other suggestions.

Thanks,
Chris

___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs