Thanks, that helps a lot! However, it appears that attaching a class to the text field cancels capture of the MouseUp/MouseDown events. Not sure if this is a bug or not. Anyway, I found a way to do what I needed which achieves all my goals.
Joe Frazier, Jr. > -----Original Message----- > From: Jez White [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 08, 2004 9:13 AM > To: Frazier, Joe Jr; perl-win32-gui-users@lists.sourceforge.net > Subject: Re: [perl-win32-gui-users] What Objects catch > RightClick event > > Hi, > > I made a mistake... > > ...There are a whole set of generic mouse events that Laurent > enabled not that long ago (I forgot about them!) - they apply > to most controls - including textfields and labels. The > following code creates a label and a textfield with left and > right click mouse events. I'm not sure when this code went > in, so if it doesn't work for you you'll have to get the > latest PPM from Laurent's site:) > > Cheers, > > jez. > > use Win32::GUI; > > my $mainWindow = new Win32::GUI::Window ( > -name => "mainWindow", > -title => "Testing", > -pos => [0, 0], > -size => [300, 300], > ); > $mainWindow->AddLabel ( > -name => "Label", > -pos => [20, 20], > -size => [40, 40], > -text => 'some text', > -notify => 1, > -onMouseDown => sub {print 'Left click';}, > -onMouseRightDown => sub {print 'right click';}, > ); > > $mainWindow->AddTextfield ( > -name => "Text", > -pos => [60, 20], > -size => [40, 40], > -text => 'some text', > -onMouseDown => sub {print 'Left click';}, > -onMouseRightDown => sub {print 'right click';}, > ); > > $mainWindow->Show; > > Win32::GUI::Dialog(); > > > > ----- Original Message ----- > From: "Frazier, Joe Jr" <[EMAIL PROTECTED]> > To: "Jez White" <[EMAIL PROTECTED]>; > <perl-win32-gui-users@lists.sourceforge.net> > Sent: Thursday, July 08, 2004 1:43 PM > Subject: RE: [perl-win32-gui-users] What Objects catch > RightClick event > > > Well, I tried to catch the right click on the window level also, but > that seemed to fail also. I do not know enough about the > hook method to > even begin. > > Here is what I am really trying to do: > > I have a window where one of the controls needs to have a hyperlink > (using Win32::GUI::Hyperlink). Before adding the Hyperlink, this > control was a text field containing UNC path. I then added the > Hyperlink, but could not find any way to get the click event > on the text > field. So.... I switched to the Label (with an etched border to > "simulate" the appearance of a text field as much as possible) because > at least I could use the notify flag to get the click event (why is > there a click for a label anyway, but not for a text field????). > > Now, since the control is a label, I can click the hyperlink > and get the > click event, however, I cannot select the data for copying. So, my > thought was to put an event handler onto the rightclick > event. But, as > we see, that is not catchable either. I even tried to attach a > rightclick event to the window object, but did not have luck with that > either. > > My ultimate goal would be to be able to use a textfield as a first > choice, as long as I can catch both the click and right click events. > Baring that, I would then be fine with using Hook or any > other method to > get what I need done. If something like this can be done with Hook, > can someone send an example as I really can't find an example > on the Web > for simular to what I am trying to do. > > Thanks, > > Joe Frazier, Jr. > > > -----Original Message----- > > From: Jez White [mailto:[EMAIL PROTECTED] > > Sent: Thursday, July 08, 2004 5:01 AM > > To: Frazier, Joe Jr; perl-win32-gui-users@lists.sourceforge.net > > Subject: Re: [perl-win32-gui-users] What Objects catch > > RightClick event > > > > Hi, > > > > I was just about to say you could try and hook the event - > > but I just had a look at MS documentation an there doesn't > > seem to be a right click event for a label. Surely that can't > > be correct? > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en- > > us/shellcc/platform/commctls/staticcontrols/staticcontrolrefer > > ence/staticcontrolmessages/stn_clicked.asp > > > > Perhaps another solution would be to trap the right click in > > the parent window, and use the mouse coordinates to see if > > the pointer is over the label. > > > > Cheers, > > > > jez. > > ----- Original Message ----- > > From: "Frazier, Joe Jr" <[EMAIL PROTECTED]> > > To: <perl-win32-gui-users@lists.sourceforge.net> > > Sent: Thursday, July 08, 2004 12:03 AM > > Subject: [perl-win32-gui-users] What Objects catch RightClick event > > > > > > I am trying to implement a context menu and need to know > what objects > > support rightclick event? I know Treeview does from the > example, but > > what I am really looking for is any way to trigger a popup > > from a label > > (I had to implement a field as a label to catch the click event that > > textfield does not. > > > > Is there any way to have a label catch a right click? > > > > Joe Frazier, Jr. > > Senior Support Engineer > > > > Peopleclick Service Support > > Tel: +1-800-841-2365 > > E-Mail: [EMAIL PROTECTED] > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by Black Hat Briefings & Training. > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > > digital self defense, top technical experts, no vendor pitches, > > unmatched networking opportunities. Visit www.blackhat.com > > _______________________________________________ > > Perl-Win32-GUI-Users mailing list > > Perl-Win32-GUI-Users@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > > > > > > > > > > > >