Jump to content

Recommended Posts

Posted

Hi @ all,

I'm just trying to set some diffrent fonts for diffrent states.

So I read that GuiSetCrtlFont GuiSetFont, and thought "" as fontname should set things to the default font. B)

As far as I can see, this does not work. I use 3.1.1, example is here:

#include <GuiConstants.au3>

GUICreate ( "Bla" )
GUICtrlCreateLabel ( "Test" ,10,10)
$Test=GUICtrlCreateLabel ( "Test",10,30)
GUISetState ()
GUICtrlSetFont ( $Test,9, 400, 0, ""); All the default I could find in the help-file.
GUICtrlSetColor ( $Test, 0xff0000)

    While 1
        $Antwort = GUIGetMsg()
        Select
        Case $Antwort = $GUI_EVENT_CLOSE
            ExitLoop
        EndSelect
    WEnd

It's not that critical, but would be nice to know. :o

Posted

this was the best i could do

#include <GuiConstants.au3>

GUICreate ( "Bla" )
GUISetFont( 10, 400)
GUICtrlCreateLabel ( "Test" ,10,10)
$Test=GUICtrlCreateLabel ( "Test",10,30, 80, 25)
$btn1 = GUICtrlCreateButton("change", 20, 150, 80, 20)
$btn2 = GUICtrlCreateButton("reset", 120, 150, 80, 20)
GUISetState ()



    While 1
        $Antwort = GUIGetMsg()
        Select
        Case $Antwort = $btn1
            GUICtrlSetFont ( $Test,16, 700, 0, ""); All the default I could find in the help-file.
            GUICtrlSetColor ( $Test, 0xff0000)
        Case $Antwort = $btn2
            GUICtrlSetFont ( $Test, -1, -1, -1, -1)
            GUICtrlSetColor ( $Test, -1)
        Case $Antwort = $GUI_EVENT_CLOSE
            ExitLoop
        EndSelect
    WEnd

8)

NEWHeader1.png

Posted

So you do GuiSetFont & -1 ... That's ok. Thx B)

i did notice that i had to use

GUISetFont( 10, 400)

otherwise the -1 would only reset to 10 point font.... not the original 9 point font

this may be an error in Autoit

8)

NEWHeader1.png

Posted

Yes, I got that error, too.

Switched to

GUISetFont( 9.005, 400, 0, "Arial")

What's the default-font, anyway?

thats what i was saying

the original "default" font appears to be 9 point

however when i tried to "reset" the font it would only go down to 10 point not 9 point..

thus, i had to make the default 10 point in the script so it would work correctly..

if you use

GUISetFont( 9.005, 400, 0, "Arial")

then my test script will not work... ( because it will only reduce the test line to 10 point )

it seems as Autoit starts in 9 point font and when asked to return to default it goes to 10 point font

8)

NEWHeader1.png

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...