Just to be strictly accurate, "Focus" is a keyboard concept. Mouse events do not have a "Focus" context, but applications do have the concept of "active window", which applies to top level windows only.
If this behaviour is important to you then the wParam of the WM_ACTIVATE indicates how a window became activated: http://msdn.microsoft.com/en-us/library/ms646274(v=vs.85).aspx You could implement a WM_ACTIVATE handler on your application form call inherited first to get the default message handling, and then if wParam is WA_CLICKACTIVE you could lookup the control at the mouse position and send it a WM_LBUTTONDOWN message, effectively resurrecting and forwarding the mouse button message that was consumed and transformed into the ACTIVATE message. I have no idea whether that would actually work but it could be fun to try it. :) On 16 September 2011 11:10, Geoff & Jacquie <[email protected]> wrote: > I have noticed the same behaviour using a mouse and decided it is normal > for windows apps. If the form doesn’t have focus then why would it process > the button event? I think the first event on an unfocussed form or app > probably sets the focus and is then discarded. This behaviour is different > in a browser window as you note.**** > > ** ** > > As for type of control, while my browser has focus, no menus, buttons, > put-cursor-here-click, on this Outlook message window results in the action > obtained when clicked “while using Outlook”. I have to click again.**** > > ** ** > > Geoff & Jacquie Jenkins, State Electronics,**** > > *1576 Weranui Road > RD 1 > Silverdale 0994* > > Ph 09 9581000* * > > Computer software development professionals, web development amateur > Computers & Peripherals sales and service. > Linksys Partner VAR - Business Systems, LVS (VOIP) & Linksys One**** > > ** ** > ------------------------------ > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *John Bird > *Sent:* Friday, 16 September 2011 3:06 a.m. > > *To:* NZ Borland Developers Group - Delphi List > *Subject:* Re: [DUG] Form activation / Mouse click**** > > ** ** > > That might be a Windows issue? I have seen other programs where clicking > a button in a non-focussed app does not click the button, and some where it > does. Eg Windows Mail clicking send receive does activate the form but does > not click the Send Receive button. However a Firefox Refresh button will > activate even if the Firefox Window does not have focus....**** > > **** > > I suspect its the type of control – maybe Toolbar buttons or Speedbuttons > do and others do not for instance? (guessing)**** > > **** > > John Bird > JBCL > Contact: > [email protected] > [email protected] > (027 4844528) > http://www.jbcl.co.nz > http://jbclnz.googlepages.com**** > > **** > > *From:* Ross Levis <[email protected]> **** > > *Sent:* Thursday, September 15, 2011 2:32 AM**** > > *To:* 'NZ Borland Developers Group - Delphi List' <[email protected]> * > *** > > *Subject:* [DUG] Form activation / Mouse click**** > > **** > > In my D7 app it is possible to have 2 non-modal forms on the screen with > buttons on each. A customer who has a touch screen says when he touches a > button on the form that doesn’t currently have the focus, the button doesn’t > get clicked. First touch only activates the form and a 2nd touch is > required.**** > > **** > > Anyone know why that would be? I would have thought a touch on a screen > touch was identical as clicking with a mouse.**** > > **** > > Cheers, > Ross.**** > ------------------------------ > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: [email protected] > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [email protected] with > Subject: unsubscribe**** > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: [email protected] > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to [email protected] with > Subject: unsubscribe >
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
