Jump to content

Recommended Posts

Posted

Setting the width and heigth causes it to occupy more space, but the checkbox itself is still small. I've tried both GUISetFont and GUICtrlSetFont with no success, even though the help file says:

  Quote

By default, controls use the font set by GUISetFont

Thanks for any help.
  • Moderators
Posted

qwert,

As far as I know you cannot change the size of an API-created checkbox. If you want a larger one you need to create your own custom version - perhaps along these lines:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("", 9, 9, 22, 22)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$hCheck = GUICtrlCreateLabel("", 10, 10, 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, 16)
GUICtrlCreateLabel("A user-drawn checkbox", 35, 15, 200, 20)

GUICtrlCreateCheckbox("An API-created checkbox", 10, 100, 200, 20)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hCheck
            Switch GUICtrlRead($hCheck)
                Case ""
                    GUICtrlSetData($hCheck, "X")
                Case Else
                    GUICtrlSetData($hCheck, "")
            EndSwitch
    EndSwitch
WEnd

A lot more work, but a pretty pleasing result. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

I was afraid that might be the case, since so few dialogs have anything other than the "tiny standard". It's hard to believe Windows has gotten away with such a limited implementation for all these years.

I had already thought of toggling between two graphics. When I get more time, I'll use your script to test and refine that technique.

I appreciate your response.

Posted

  On 10/20/2011 at 7:31 AM, Melba23 said:

qwert,

As far as I know you cannot change the size of an API-created checkbox. If you want a larger one you need to create your own custom version - perhaps along these lines:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
 
$hGUI = GUICreate("Test", 500, 500)
 
GUICtrlCreateLabel("", 9, 9, 22, 22)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$hCheck = GUICtrlCreateLabel("", 10, 10, 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, 16)
GUICtrlCreateLabel("A user-drawn checkbox", 35, 15, 200, 20)
 
GUICtrlCreateCheckbox("An API-created checkbox", 10, 100, 200, 20)
 
GUISetState()
 
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hCheck
            Switch GUICtrlRead($hCheck)
                Case ""
                    GUICtrlSetData($hCheck, "X")
                Case Else
                    GUICtrlSetData($hCheck, "")
            EndSwitch
    EndSwitch
WEnd

A lot more work, but a pretty pleasing result. :graduated:

M23

Wow this is really good. Took me a minute to get my head around what it was doing.. Does the possibilities of Autoit never end?! You got me thinking now about what kinds of things like this I have missed. Nice job!

  • Moderators
Posted

Morthawt,

  Quote

Does the possibilities of Autoit never end?!

I rather think not! :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

You can use the font 'Marlett' to have the original characters.

$hGUI = GUICreate("Test", 200, 150)

$hCheck1 = GUICtrlCreateLabel("", 10, 10, 20, 20, 0x1201)
GUICtrlSetFont(-1, 19, 400, 0, "Marlett")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$hLbl1 = GUICtrlCreateLabel("A user-drawn checkbox", 35, 15, 200, 20)

$hCheck2 = GUICtrlCreateLabel("", 10, 50, 25, 25, 0x1201)
GUICtrlSetFont(-1, 24, 400, 0, "Marlett")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$hLbl2 = GUICtrlCreateLabel("Another user-drawn checkbox", 40, 57, 200, 20)

GUICtrlCreateCheckbox("An API-created checkbox", 10, 100, 200, 20)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case -3
            Exit
        Case $hCheck1, $hLbl1
            Switch GUICtrlRead($hCheck1)
                Case ""
                    GUICtrlSetData($hCheck1, "a")
                Case Else
                    GUICtrlSetData($hCheck1, "")
            EndSwitch
        Case $hCheck2, $hLbl2
            Switch GUICtrlRead($hCheck2)
                Case ""
                    GUICtrlSetData($hCheck2, "r")
                Case Else
                    GUICtrlSetData($hCheck2, "")
            EndSwitch
    EndSwitch
WEnd

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.

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
  • Recently Browsing   0 members

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