The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Mark Jones on August 19, 2005, 03:58:14 PM

Title: Loses Focus msg?
Post by: Mark Jones on August 19, 2005, 03:58:14 PM
Is there a message for "control loses focus?" I'm shadowing all of my controls' values into a struct and would like to update each member as the mouse leaves each control (rather than updating all of them when any control is changed.) Any ideas? Is subclassing the only answer?
Title: Re: Loses Focus msg?
Post by: Tedd on August 19, 2005, 05:08:46 PM
WM_KILLFOCUS is sent to a window just before it loses focus.
Is that what you mean?
Title: Re: Loses Focus msg?
Post by: ramguru on August 19, 2005, 05:18:25 PM
I used "TrackMouseEvent" to make my 3 state (up enter/leave down) button in WM_MOUSEMOVE msg.
Title: Re: Loses Focus msg?
Post by: Mark Jones on August 20, 2005, 06:23:18 AM
I'm hoping for a "WM_LOSESFOCUS" message but there doesn't appear to be anything like this. Basically I have a window with some controls on it (edit boxes, checkboxes, etc.) and I have all their states and values shadowed into a struct. This makes it easy to save and restore the state of all controls, simply by using Get/WritePrivateProfileStruct to an .ini file. But in my current implementation, all the controls are copied to the structure whenever the window loses focus (on WM_ACTIVATE message.) But if I change one value then press the "go" button lets say, the changed value has not been updated in the shadow struct yet, so errors occur. What I want to do it catch some message when the mouse or focus leaves each individual control - so that the control losing focus can have it's new value copied into the shadow struct. :) Hope I made that clear enough. It's kinda hard to explain and a nightmare to look at as code. :)
Title: Re: Loses Focus msg?
Post by: Tedd on August 20, 2005, 02:58:47 PM
Hmm... looks like it's gonna be subclassing or the parent tracking the mouse for each individual component. :bdg
I think subclassing would be better; especially if it's mostly only for edit boxes(?)