GUI programming has been annoying me recently, I can't find decent non mfc examples, the few on msdn leave out parts and neglect to tell you key bits such as when specific window styles are required :x

But anyway, I've a prob with Tab controls, msdn says to uses dialog boxs as containers for each tab page, unfortunatly when I do this I get what you see in the right image below; a dark outline inside the tab.

When I have the controls floating on the main dialog I get a dark border around the button which I can't recreate at the moment.

And finally set I set the controls as children of the tab I get the problem shown in the left where the text of static controls is highlighted, and a worse problem occurs with edit boxes.

So is it that one of these methods need to be modified, maybe there so way of making a dialog box transparent. Or should tabs be handled differently entirly ????
Posted on 2004-08-31 15:51:49 by Eóin
Maybe the problem is with the WS_CLIPCHILDREN and/or WS_CLIPSIBLINGS styles? If worse comes to worse, use WS_EX_TRANSPARENT and block all WM_ERASEBKGRND messages.

Some samples:

Tab controls using dialogs:
http://spiff.tripnet.se/~iczelion/files/TabbedDialog.zip

Property sheets and wizards:
http://spiff.tripnet.se/~iczelion/files/PropWiz.zip

An old thread on tab controls in XP:
http://www.asmcommunity.net/board/viewtopic.php?t=9977

Hope that helps :)
Posted on 2004-08-31 16:47:17 by QvasiModo
Thanks for your reply, the tab example you posted demonstrates the second method I tried and the dark border is still visible around the buttons. Must be because the button thinks its a child of the dialog and draws it outline to match that and not the brighter tab.

The property sheets on the other hand don't demonstrate this problem at all, but I don't have much experience with them and don't know if they can be used on dialogs.
Posted on 2004-08-31 17:14:48 by Eóin
did you tried WS_EX_CONTROLPARENT for child dialogs when you tried to use the main dialog is parent of child dialogs?

however, i dont have XP. BTW, if i remember right, i have seen a thread about background colors on XP. And if i remember right, again :), donkey was suggested something. Huh, i wonder if this thread is existing too :) good luck.
Posted on 2004-08-31 18:34:34 by cakmak
I have not used Dialog based Tab control, so there may be small differences (I create mine manually).
Still, I have had the same problems which now plague you.
Now this might sound messy, but it works for me.
In WndProc, at the WM_CREATE, I create my main Tab control, and then create the child tabs. I create all the window controls as children of the Tab control, then I hide whichever controls are not on the first tab, and finally, I use a combination of WM_NOTIFY/TCN_SELCHANGE to determine when the active Tab changes and then based on which Tab is active I hide / show controls.
Should any of my controls fail to appear in the Tab control (like Buttons), I make those controls children of hWin but still use the same hide/show logic as the rest.
I have not read any of the above source, my method comes pretty much from Iczelion's example.
BTW - there is normally only ONE TAB CONTROL WINDOW - I use the following code to add the "tab child controls" to it


InsertTabItem proc dItemIndex, pText
local tci:TC_ITEM
invoke RtlZeroMemory,addr tci,sizeof tci
mov tci.imask,TCIF_TEXT
m2m tci.pszText, pText
invoke SendMessage, hTab, TCM_INSERTITEM,dItemIndex,addr tci
ret
InsertTabItem endp

Hope that helped.
Posted on 2004-09-01 01:40:48 by Homer
Thanks for the reply Evil Homer, I've managed to get your method working now. When I tried it yesterday I was getting redrawing problems with edit boxes and static controls, However by includng a SetWindowPos with HWND_TOP after the SetParent call all those problems have gone away :)

Thanks all.
Posted on 2004-09-01 02:30:29 by Eóin