Next time I'm having dinner with Bill Gates I will ask him why it is that Windows forces certain objects to have black caption text in some themes, but not in others.Marcus, its impractical to force a user to change this setting so a certain macro will work properly... so now that we know what is causing this, how do we get around it?
SetDialogObjectFont anomaly
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
You have dinner with Bill Gates!!!??? Forget talking about Windows. Get him to talk moneyNext time I'm having dinner with Bill Gates...

I have a solution that will work in my little empire and may be suitable for others. The Windows API function EnableTheming will turn off the current theme (turns theme to Windows Classic) and restore the previous theme. However, there are some caveats.
1-- If for some reason the script is aborted before the previous theme is restored obviously the previous theme will not be restored. This is really unlikely because the theme can actually be turned off on one line of script and restored on the next line and the colored objects will still all display correctly.
2-- If after a script that alters the theme is run on a computer and a user goes to look at the themes, For some reason Windows will report that the current theme is "Windows Classic". I don't think this is really the case but might confuse an unknowing user. The reason I don't think its the case is that after a reboot the non-classic theme is restored.
I have only tested this bouncing between Windows XP Style and Windows Classic Style. I can't guarantee that a customized theme will restore properly
I'd be interested to know if this works for others, and if anyone finds a great issue that I missed. Note the first two lines. Enable theming off and enable theming restore.
Code: Select all
LibFunc>UxTheme,EnableTheming,ETres,0
LibFunc>UxTheme,EnableTheming,ETres,1
Dialog>Dialog1
Caption=Color Change Test
Width=539
Height=312
Top=CENTER
Left=CENTER
Label=Part Number:,32,16,true
Label=Revision:,32,48,true
Button=BLUEPRINTS,24,131,262,40,3
Edit=msEdit1,29,181,121,TEST
Memo=msMemo1,184,12,159,89,TEST
ListBox=msListBox1,359,11,121,97,Item1%CRLF%Item2
ComboBox=msComboBox1,358,115,145,Item1%CRLF%Item2
RadioGroup=msRadioGroup1,Test,329,148,185,105,Item1%CRLF%Item2,-1
CheckBox=msCheckBox1,Change Color,27,87,142,True
EndDialog>Dialog1
SetDialogObjectColor>Dialog1,,16777215
Let>Blue=16744576
Let>Green=5878528
Let>Red=128
Let>ccflag=1
SetDialogObjectFont>dialog1,mslabel1,Arial,12,1,red
SetDialogObjectFont>dialog1,mslabel2,Arial,12,1,red
SetDialogObjectFont>dialog1,msbutton1,Arial,24,1,red
SetDialogObjectFont>dialog1,msCheckBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msEdit1,Arial,12,1,red
SetDialogObjectFont>dialog1,msMemo1,Arial,12,1,red
SetDialogObjectFont>dialog1,msListBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msComboBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msRadioGroup1,Arial,12,1,red
Show>dialog1
Label>Loop
GetDialogAction>dialog1,res1
If>res1=2
Exit>0
EndIf
If>res1=3
ResetDialogAction>dialog1
mdl>OK
EndIf
If>{(%dialog1.mscheckbox1%="True") and (%ccflag%=1)}
SetDialogObjectFont>dialog1,mslabel1,Arial,12,1,red
SetDialogObjectFont>dialog1,mslabel2,Arial,12,1,red
SetDialogObjectFont>dialog1,msbutton1,Arial,24,1,red
SetDialogObjectFont>dialog1,msCheckBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msEdit1,Arial,12,1,red
SetDialogObjectFont>dialog1,msMemo1,Arial,12,1,red
SetDialogObjectFont>dialog1,msListBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msComboBox1,Arial,12,1,red
SetDialogObjectFont>dialog1,msRadioGroup1,Arial,12,1,red
Let>ccflag=2
EndIf
If>{(%dialog1.mscheckbox1%="False") and (%ccflag%=2)}
SetDialogObjectFont>dialog1,mslabel1,Arial,12,1,green
SetDialogObjectFont>dialog1,mslabel2,Arial,12,1,green
SetDialogObjectFont>dialog1,msbutton1,Arial,24,1,green
SetDialogObjectFont>dialog1,msCheckBox1,Arial,12,1,green
SetDialogObjectFont>dialog1,msEdit1,Arial,12,1,green
SetDialogObjectFont>dialog1,msMemo1,Arial,12,1,green
SetDialogObjectFont>dialog1,msListBox1,Arial,12,1,green
SetDialogObjectFont>dialog1,msComboBox1,Arial,12,1,green
SetDialogObjectFont>dialog1,msRadioGroup1,Arial,12,1,green
Let>ccflag=1
EndIf
Goto>Loop