Solved

child window does not receive

Posted on 1997-09-12
3
368 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

717 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