1
votes

I have a base form that all MDI child forms inherit from. The OnCreate makes a call to the notify the main form a new tab needs to be created. That tab's caption uses the MDIChild's caption.

When child window caption is changed at run-time, how can I capture or be notified so its corresponding tab can be updated with the new caption?

Looking for something like how the Main form's WindowMenu property works.

I have tried to capture the WM_MDISETMENU message in the main form, but no luck:

procedure TMainForm.WMMDISetMenu(var Msg: TWMDISetMenu); message WM_MDISETMENU;

I have researched high and low, but to no avail. Is there a real answer out there somewhere?

1
How is the "child window caption changed at runtime"? What are you doing to change that caption? - Ken White
I don't know if it will solve your problem, but WM_MDISETMENU is not sent to your main form. It is sent to the MDI client. You need to subclass the MDI client, unfortunately ClientWndProc is not virtual in D7. - Sertac Akyuz
Ken, On the DataSource's OnDataChange event, the caption is changed to indicate the current Order ID, etc. - Mike Howard

1 Answers

3
votes

Since you've subclassed the child-window class already, all you have to do is handle the wm_SetText message. Call the inherited handler, and then update the tab caption.