BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TCustomControl and form / application active

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Jens Gruschel
Guest





PostPosted: Sun Oct 26, 2003 10:47 pm    Post subject: TCustomControl and form / application active Reply with quote



Hello,

I want my TCustomControl to look different if the parent form / application
is not active. I tried to catch WM_ACTIVATE and WM_ACTIVATEAPP, but without
success. Can anyone help?

Jens



Back to top
Kurt Barthelmess
Guest





PostPosted: Mon Oct 27, 2003 10:22 am    Post subject: Re: TCustomControl and form / application active Reply with quote



"Jens Gruschel" <nospam (AT) pegtop (DOT) net> wrote:

Quote:
I want my TCustomControl to look different if the parent form / application
is not active. I tried to catch WM_ACTIVATE and WM_ACTIVATEAPP, but without
success. Can anyone help?

Child windows do not get such notifications - they go to the main
window (if there.) Usually this is only done if the user moves to
another control within the application. That can be "caught" by
watching for a CM_EXIT message. But if the focus moves to another
application, the previous app doesn't really care. It also gets
complicated by the definition of "active" - if your app is processing
messages (like a WM_TIMER or something that you add to check for this)
then you are active. Catch-22<g>.

Good luck.

Kurt


Back to top
Jens Gruschel
Guest





PostPosted: Mon Oct 27, 2003 2:32 pm    Post subject: Re: TCustomControl and form / application active Reply with quote



Quote:
Child windows do not get such notifications - they go to the main
window (if there.) Usually this is only done if the user moves to
another control within the application. That can be "caught" by
watching for a CM_EXIT message. But if the focus moves to another
application, the previous app doesn't really care. It also gets
complicated by the definition of "active" - if your app is processing
messages (like a WM_TIMER or something that you add to check for this)
then you are active. Catch-22<g>.

If an item of a TListView is selected, and I click on another window (of
another application), the item is not highlighted any more. So it must be
possible, right?

Jens




Back to top
Kurt Barthelmess
Guest





PostPosted: Mon Oct 27, 2003 5:37 pm    Post subject: Re: TCustomControl and form / application active Reply with quote

"Jens Gruschel" <nospam (AT) pegtop (DOT) net> wrote:

Quote:
If an item of a TListView is selected, and I click on another window (of
another application), the item is not highlighted any more. So it must be
possible, right?

There are three states you can be in: Focused, Application Active (but
not focused), and Application Inactive (also not focused). I thought
you wanted to distinguish between the last two of these.

If all you care about is losing the focus - watch for a CM_EXIT
message or use the OnExit event handler.

Good luck.

Kurt


Back to top
Jens Gruschel
Guest





PostPosted: Mon Oct 27, 2003 8:57 pm    Post subject: Re: TCustomControl and form / application active Reply with quote

Quote:
There are three states you can be in: Focused, Application Active (but
not focused), and Application Inactive (also not focused). I thought
you wanted to distinguish between the last two of these.

I want to change the appearance of my control depending on the Focused
property (like a TButton gets or looses its focus rectangle). Focused
becomes False when I activate another window (of the same or another
application). But there seems to be no notification message when Focused
switches from True to False. So all I need is some notification whenever
Focused changes (which in Fact is a function, no property).

CM_ENTER and CM_EXIT only fire when another control within the same form
gets the focus, not when another window becomes activated. My control cannot
catch WM_ACTIVATE or WM_ACTIVATEAPP. CM_GOTFOCUS and CM_LOSTFOCUS seem not
be used at all. I found that CM_UIACTIVATE does work. While CM_UIDEACTIVATE
should be the opposite, unfortunatelly it seems not to work :-(

Quote:
If all you care about is losing the focus - watch for a CM_EXIT
message or use the OnExit event handler.

....which is only fired when the parent form's ActiveControl property
changes, not when the Focused "property" of the control changes.

Jens




Back to top
Jens Gruschel
Guest





PostPosted: Mon Oct 27, 2003 9:26 pm    Post subject: Re: TCustomControl and form / application active Reply with quote

Quote:
CM_ENTER and CM_EXIT only fire when another control within the same form
gets the focus, not when another window becomes activated. My control
cannot
catch WM_ACTIVATE or WM_ACTIVATEAPP. CM_GOTFOCUS and CM_LOSTFOCUS seem not
be used at all. I found that CM_UIACTIVATE does work. While
CM_UIDEACTIVATE
should be the opposite, unfortunatelly it seems not to work Sad

I just found that WM_SETFOCUS and WM_KILLFOCUS do exactly what I need.
Thanks for your time and patience!

Jens




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.