haohaolee
haohaolee

Reputation: 707

How to notify TabCtrl when its parent window closes?

I'm using BCG Pro's control CBCGPTabWnd, which contains multiple tab windows, when the parent Dialog's OnOK() is called, I don't know how to notify the tab windows for cleanup and save work.

And I cannot add public interfaces for those tab windows to call to do this.

Now I'm using TabWnd->SendMessage(WM_COMMAND, IDOK) in the parent's OnOK handler to stimulate the OnOK Message for those child tab windows, because they are actually dialog-based windows.

Am I doing this right?

PS: Generally it would be better if I can notify them explicitly, WM_DESTROY is an option but it can only be used in Closing and is hard to control the timing

Upvotes: 0

Views: 175

Answers (1)

xMRi
xMRi

Reputation: 15365

Just send a private/cursom message internally with WM_APP+n. Handle it with ON_MESSAGE.

This makes it possible to react on every case were your parent needs to inform the embedded child windows. And you can implement it in different window types.

Upvotes: 1

Related Questions