Odd Effect in Custom Parent/Child window Implimentation
My code makes use of the Windows API and Visual C++ 6.0
I''m not sure what I''m doing wrong...
Currently, I''m implimenting a separate custom window class for a parent and single child window.
Everything works as I expect it to, except for one small detail...
When the child window should be receiving focus, it behaves as it should, except that it doesn''t have its title bar indicating that. In a standard windows color scheme, it remains gray (no focus) even when it should become blue (has focus).
Each custom class uses the creation flags: WS_OVERLAPPEDWINDOW and WS_VISIBLE
In addition to these, the parent window includes: WS_CLIPCHILDREN
The child window includes: WS_CHILD | WS_CLIPSIBLINGS
If I remove the WS_CHILD flag, the child window no longer falls victim to the strange no-focus-color effect, however it is no longer confined to the parent''s window space, and this is not what I want.
Can anybody please shed some light on the matter?
Thanks.
December 22, 2000 11:31 AM
I don''t know the answer.
Anybody want to help this guy out?
(getting post back into rotation)
Anybody want to help this guy out?
(getting post back into rotation)
I guess it has something to do with the child window not receiving the WM_ACTIVATEAPP. You can try sending it yourself?!
If that doesnt work - You can always catch the WM_NCPAINT message, and draw your own title bar.
Edited by - BasKuenen on December 22, 2000 1:58:24 PM
If that doesnt work - You can always catch the WM_NCPAINT message, and draw your own title bar.
Edited by - BasKuenen on December 22, 2000 1:58:24 PM
Yea I remember having this problem (in MFC) a bit ago while trying to avoid using Doc/View architecture while having an application that behaved in that way. Never actually found a fix nor needed it eventually. Here is a replication of the problem in MFC.
#include "afxwin.h"class CApp : public CWinApp{public: BOOL InitInstance() { CFrameWnd *thewnd =new CFrameWnd, *chwnd = new CFrameWnd; thewnd->Create(NULL, "Main Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE, thewnd->rectDefault, NULL, NULL); RECT r = {10,10,330,410}; chwnd->Create(NULL, "Child Window", WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CHILD, r, thewnd, NULL); m_pMainWnd = thewnd; return TRUE; }} Myapp;
cmaker- I do not make clones.
Child windows, when they have a title bar, will never have the foreground color for it. Activating a child window activates it''s parent instead. This is how they''re supposed to work.
quote: Original post by FordPrefect
Child windows, when they have a title bar, will never have the foreground color for it. Activating a child window activates it''s parent instead. This is how they''re supposed to work.
I disagree that this is how it is supposed to work. I understand why this happens, but it clearly doesn''t visually make sense.
cmaker- I do not make clones.
Sorry I was away for so long.
Sending the activate message manually did not seem to have any effect on the title bar''s color, and I did confirm that the message was received properly.
I''m curious about the manual painting of a title bar. How do you do this exactly? I searched extensively for an answer as to how any title bar is painted the way it is in the first place, and found nothing that worked.
I''m not using any MFC, by the way.
Sending the activate message manually did not seem to have any effect on the title bar''s color, and I did confirm that the message was received properly.
I''m curious about the manual painting of a title bar. How do you do this exactly? I searched extensively for an answer as to how any title bar is painted the way it is in the first place, and found nothing that worked.
I''m not using any MFC, by the way.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement