Jump to content

Checkbox problem with GUI_BKCOLOR_TRANSPARENT


Mungo
 Share

Recommended Posts

Setting $GUI_BKCOLOR_TRANSPARENT for checkboxes seems to behave differently under Windows XP choosing the "Windows classic" or "Windows XP" (default) display themes?

I normally work with the "Windows classic" (Windows 2000 type) theme but realised the difference when I swapped. Or am I doing something wrong here? Any idea?

Cheers

Mungo

#include <GUIConstantsEx.au3>
transparency_example()
Func transparency_example()
    Local $msg
    GUICreate("Transparency test ...", 300, 275)
    ; creates an orange background box
    GUICtrlCreateLabel("", 10, 10, 280, 125)
    GUICtrlSetBkColor(-1, 0xff8c00)
    GuiCtrlSetState(-1, $GUI_DISABLE)
    ; checkbox and label over the orange background
    GUICtrlCreateCheckbox("Transparency NOT SET", 25, 25, 250, 20)
    GUICtrlCreateCheckbox("Transparency SET", 25, 50, 250, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlCreateLabel("Transparency NOT SET", 25, 75, 250, 14)
    GUICtrlCreateLabel("Transparency SET", 25, 100, 250, 14)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    ; checkbox and label on default background
    GUICtrlCreateCheckbox("Transparency NOT SET", 25, 150, 250, 20)
    GUICtrlCreateCheckbox("Transparency SET", 25, 175, 250, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlCreateLabel("Transparency NOT SET", 25, 200, 250, 14)
    GUICtrlCreateLabel("Transparency SET", 25, 225, 250, 14)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc

PS: Two screenshots - both under Win XP!: Left with "Windows classic " , right "Windows XP" desktop theme selected.

post-57589-0-53069100-1294273375_thumb.j

post-57589-0-15023100-1294273395_thumb.j

Edited by Mungo
Link to comment
Share on other sites

$GUI_BKCOLOR_TRANSPARENT for checkboxes does not work now with AutoIt. Simply use a child gui instead of the orange label to show it the right way.

#include <GUIConstantsEx.au3>
transparency_example()

Func transparency_example()
 Local $msg, $hParent, $hChild
 $hParent = GUICreate("Transparency test ...", 300, 275)

 ; checkbox and label over the orange background
 ; creates an orange background box
 $hChild = GUICreate("Child", 280, 125, 10, 10, 0x40000000, 0, $hParent)
 GUISetBkColor(0xff8c00)

 GUICtrlCreateCheckbox("Transparency NOT SET", 25, 25, 250, 20)
 GUICtrlCreateCheckbox("Transparency SET", 25, 50, 250, 20)
 GUICtrlCreateLabel("Transparency NOT SET", 25, 75, 250, 14, -1, 0x20)
 GUICtrlCreateLabel("Transparency SET", 25, 100, 250, 14);, -1, 0x20)

 GUISetState()
 GUISwitch($hParent)

 ; checkbox and label on default background
 GUICtrlCreateCheckbox("Transparency NOT SET", 25, 150, 250, 20)
 GUICtrlCreateCheckbox("Transparency SET", 25, 175, 250, 20)
 GUICtrlCreateLabel("Transparency NOT SET", 25, 200, 250, 14)
 GUICtrlCreateLabel("Transparency SET", 25, 225, 250, 14)

 GUISetState()

 While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE Then ExitLoop
 WEnd
EndFunc   ;==>transparency_example

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Many thanks for the hint and the work around example!

I only have XP (and Win2000) to test on. Any idea whether the $GUI_BKCOLOR_TRANSPARENT for checkboxes similarly does not work with later windows versions such as Vista and Windows 7 etc. ?

Cheers

Mungo

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...