XP-style tabbers: why doesn't this work?

BlitzMax Forums/BlitzMax Programming/XP-style tabbers: why doesn't this work?

taxlerendiosk(Posted 2005) [#1]
Even with a manifest file specifying to use visual styles, the inside of a tabber in MaxGUI displays as the same colour as the window. To see how it should look with visual styles, go to Control Panel and open display or audio properties, and look at the tabber there - the tab page is white, the same colour as the tab itself, and has a subtle gradient towards the bottom.

So, I looked around the web and found out that in order to get this to work you have to use a uxtheme.dll function called EnableThemeDialogTexture, so I tried it out...

Strict 

Local window:TGadget=CreateWindow("My Window",40,40,320,240,Null,15 | WINDOW_HIDDEN)

Local tabber:TGadget=CreateTabber(0,0,ClientWidth(window),ClientHeight(window),window)

' ... WINDOWS XP THEME STUFF START ...
Const ETDT_ENABLETAB = 6

Global EnableThemeDialogTexture(m_hWnd:Int, flags:Int);

Local Uxtheme:Int = LoadLibraryA("uxtheme.dll")
If Uxtheme
	EnableThemeDialogTexture = GetProcAddress(Uxtheme,"EnableThemeDialogTexture")
End If

EnableThemeDialogTexture(QueryGadget(tabber,QUERY_HWND),ETDT_ENABLETAB)
' ... WINDOWS XP THEME STUFF END ...

ShowGadget window

While True
	WaitEvent 
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend
...and it still doesn't work. Any idea what I'm doing wrong?


kfprimm(Posted 2005) [#2]
It works fine for me even without the XP theme stuff. Here's the manifest file I'm using.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="MyCompany.MyLabel.MyAppName"
    type="win32"
/>
<description>MultiMedia BoardCast/Scheduler.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>



WendellM(Posted 2005) [#3]
I see it as you describe, denzilquixode. I tried it with and without the XP Theme stuff (which I'm not familiar with), using a manifest made by Faena AddXPStyle like I normally use and then Khomy Prime's manifest, and in all cases only the tab portion itself shows as white, not the tab's main body:



I tried not setting the WINDOW_HIDDEN flag in case that might be throwing the color off, but that made no difference. I also tried parenting it to a panel in case it might inherit the panel's color (since a panel is one of the few gadgets that SetGadgetColor actually works with), but no luck.

XP Pro SP2, Radeon 9600 Pro in case it matters.


taxlerendiosk(Posted 2005) [#4]
After having a look at the win32maxgui source code I've gone on a totally different tack and tried this, setting a "transparent" flag on the tabber's client control:
Const GWL_EXSTYLE = -20
Const WS_EX_CONTROLPARENT = $10000
Const WS_EX_TRANSPARENT = 32


Local window:TGadget=CreateWindow("My Window",40,40,320,240)

Local tabber:TGadget=CreateTabber(0,0,ClientWidth(window),ClientHeight(window),window)

Local hWnd:Int = QueryGadget(tabber,QUERY_HWND_CLIENT)
SetWindowLongA(hWnd, GWL_EXSTYLE, WS_EX_CONTROLPARENT | WS_EX_TRANSPARENT)

Local MyLabel:TGadget = CreateLabel("Bah!",5,5,100,20,tabber)



While True
	WaitEvent 
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend
...which appears to work - except labels and stuff that are drawn on top of it STILL have the window colour background! (Label included in the above code to show what I mean.) I've been searching the web for solutions but they all seem to depend on VB/C#/.NET etc rather than API calls :(


ozak(Posted 2006) [#5]
Use the manifest. It's a great way for simpler win32 gui apps to use the XP style (which is horrible IMHO)


taxlerendiosk(Posted 2006) [#6]
Use the manifest.

Even with a manifest file specifying to use visual styles, the inside of a tabber in MaxGUI displays as the same colour as the window. To see how it should look with visual styles, go to Control Panel and open display or audio properties, and look at the tabber there - the tab page is white, the same colour as the tab itself, and has a subtle gradient towards the bottom.