Solved

child window does not receive

Posted on 1997-09-12
3
361 Views
Last Modified: 2013-12-26
My main window is derived from TDecoratedFrame with a TTabControl client window.

Within this client I show some child windows (derived from TWindow).
I want to know when these child windows are activated, deactivated or when they get or loose the input focus.
The childs are receiving mouse messages, but none of WM_ACTIVATE, WM_SETFOCUS or WM_KILLFOCUS.

What is wrong? Is it me or the OWL?
0
Comment
Question by:markusk
3 Comments
 
LVL 3

Expert Comment

by:msmits
ID: 1299388
Are these child windows the complete dialog windows that represent a Tab or are they individual controls?

When they are the child windows for the Tab, you should use activation event notification functions from the tab controls.
The dialog window itself seldomly receive the focus, as it will be the first control in that window that receives the focus.

0
 
LVL 3

Accepted Solution

by:
LucHoltkamp earned 380 total points
ID: 1299389
I assume you want to make a tabbed window, just like borland's messagewindow in the BC5 IDE.

The TabContol doesn't give your client TWindow's focus, or controls it's hiding and showing, it doesn't contain the window's. It's just a simple graphic that sends a message to it's parentwindow if you click on one of the tabs. You have to deal with focus, hiding and showing yourself in the eventhandler. And you have to add a container (Array<TWindow> for example) to the parentwindow to store the clients.
The event the TabControl sends is EV_TCN_SELCHANGE (see help for details). In the eventhandler you must hide/show the windows with TWindow::ShowWindow and enable/disable them with TWindow::EnableWindow. Finally you can set focus with TWindow::SetFocus.
There is an simple example "tabctrl.ide" in the BC5\EXAMPLES\OWL\CLASSES directory. They use a TDialog as parentwindow, because this easier than a TWindow (or TDecoratedFrame) as parent. In the TDecoratedFrame case you also have to handle the EV_WM_SIZE message, because you have to do your own layout, resizing and moving the TabControl and clientWindows if the size changes.
One more thing: you shouldn't make the TabControl the TDecoratedFrame's clientwindow, because the whole clientrectangular will be filled with your TabControl, leaving no space for the client TWindows you want to tab. Don't use a clientwindow at all.
If this is not enough info to get you started, notify me and I will mail you a implementation (source and simple exe)of a TabWindow, that acts just like Borland MessageWindow in the IDE. Perhaps you have to adapt it a little, but a would give you a good startingpoint.
.luc.
0
 

Author Comment

by:markusk
ID: 1299390
Good answer.

But what I'm going to do is a bit different from a simple tabbed window.

First, I need a TTabControl as client window. In the TabControl's client area I show some child windows (depending on the current selection).

Some of the tabs have more than one child window. I just wanted to keep track of which one is active to show some kind of border around this window.

I solved the problem with WM_LBUTTONDOWN/WM_RBUTTONDOWN messages. When one of these events occur in my child window, I remove the border from the previous "focus-child" (a static class member shows me which one), and change the style of the current active child.

This works fine, and the result is exactly what I want. I just didn't recognize, that the TabControl does not give the focus to his child windows.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now