Strange checkbox layout mismatch?

BlitzMax Forums/MaxGUI Module/Strange checkbox layout mismatch?

Grisu(Posted 2013) [#1]
Hello!

I recently recognised that the checkboxes I use aren't of the same style under Windows7 (with Aero) enabled. See row of checkboxes in the screenshot below:


Any idea what is causing this? - It's the same createbutton() code.

Using the default maxgui manifest file or my own doesn't make a difference as well. I just want every checkbox to use the classic style or the new one. But not this kind of mismatch.

Grisu


Henri(Posted 2013) [#2]
Hello,

can you reproduce this problem, maybe example ? Somehow I suspect that it's something to do with the manifest. Never come across this before.
If I try this with my manifest all seems fine
Strict

Import maxgui.drivers

?Win32

rem
Object file compiled with windres
using three files: resource.rc, <program_name>.exe.manifest and icon.ico;
Build command was: windres -i "resource.rc" -o "myobject.o"
endrem

Import "myobject.o" 
?

Local win:tgadget = CreateWindow("test",200,200,300,300,Null,WINDOW_TITLEBAR|WINDOW_STATUS|WINDOW_CENTER|WINDOW_RESIZABLE)
Local b1:tgadget = CreateButton("b1",10,10,50,23,win,BUTTON_CHECKBOX)
Local b2:tgadget = CreateButton("b2",10,40,50,23,win,BUTTON_CHECKBOX)
Local b3:tgadget = CreateButton("b3",10,70,50,23,win,BUTTON_CHECKBOX)
Local b4:tgadget = CreateButton("b4",10,100,50,23,win,BUTTON_CHECKBOX)
Local b5:tgadget = CreateButton("b5",10,130,50,23,win,BUTTON_CHECKBOX)
Local toggle:tgadget = CreateButton("Toggle",10,160,80,23,win,BUTTON_PUSH)

Global state:Int = 0

Repeat
	WaitEvent()
	Select EventID()
	
	Case EVENT_WINDOWCLOSE	End
	
	Case EVENT_GADGETACTION
		Select EventSource()
		
		Case toggle
			Select state
			
			Case 0
				state = 1
			Case 1
				state = -1
			Case -1
				state = 0
			EndSelect
			
			SetButtonState(b3,state)
			
		EndSelect
	EndSelect

Forever



-Henri


Grisu(Posted 2013) [#3]
Using my own manifest file, the examples work fine:


The GUI might be confiused, so it's sticking to the classic checkboxes. :)


BLaBZ(Posted 2013) [#4]
My computer is only rendering the older xp style and I'm on windows 7. How to I change this?


Grisu(Posted 2013) [#5]
@BLaBZ:
You need to make sure that you have Windows Aero / Basic enabled on the Windows side. And in the apps framework you need to import "MaxGui.Drivers" and a manifest file such as "MaxGui.xpmanifest".


Grisu(Posted 2013) [#6]
So, endless hours later: I found the bug... :(

As soon as I use "SetGadgetTextColor" on the checkbox, the modern style gets destroyed and the classic style is used instead.

Example code:


Please confirm. - Any Workaround? :)

Thanks!
Grisu


Henri(Posted 2013) [#7]
Nice find,

I searched a bit through MaxGUI source, and it seems that when you change text color,
the button is then ownerdrawn by OnDrawItem-method, so it's not drawn by OS anymore.
Sounds like something you should post to MaxGUI bugs-thread.

-Henri


Henri(Posted 2013) [#8]
As a workaround you could use text labels right beside checkbox and change their color instead

-Henri


Grisu(Posted 2013) [#9]
Hey,

just posted the find on the bug forums: http://www.blitzbasic.com/Community/posts.php?topic=101177#bottom

The simplest workarounds are always the best. Thanks for your assistance.

Even more spaghetti code. But it should work. :)


Grisu(Posted 2013) [#10]
Oh boy, this was a lot of "fiddling" around. But I finally made it:


For this workaround make sure that the labels / checkboxes have some free space between them. Else you will create some new gui glitches!


GaryV(Posted 2013) [#11]
Looks good Grisu!


Grisu(Posted 2013) [#12]
Thanks Gary.
I'm trying to do my best with this app for over 5 years now. :)