Sign in to follow this  
Followers 0
suthers

Getting back to default GUI fonts

3 posts in this topic

hi All,

I have a GUI where I want to be able to toggle a list box font between the default and Courier (to get a non-proportional view). I can change to Courier easily with GUICtrlSetFont(). My problem is that, once I've changed it, I can't get it back to what it was before. Using GUICtrlSetFont() with all '-1' parameters changes it to something, but it's not the original you get when the script first runs. According to the help file, the default font used in GUI's is the system default. According to the windows desktop control panel applet, my default font is Tahoma size 8. But using GUICtrlSetFont() to explicitly set that doesn't give the original result either. I have tried numerous combinations, all without success. Any suggestions?

I'm using AutoIT v3.1.1.102 (beta). PC is Win XP SP2.

Shalom

Bill

Share this post


Link to post
Share on other sites



Allrighty, here's an example.

I've found another issue too - each time the font toggle is performed, the list box shrinks by one line!!??

Any help very greatfuly recieved :-)

#include <GUIConstants.au3>

GUICreate("Font Toggle Example GUI",500,350)

$ListBoxID = GUICtrlCreateList("", 5, 5, 480, 200)
GUICtrlSetData ($ListBoxID,"|Core Text as example    -> Illustrative text|Qest                   -> Details text|?                      -> Do you need|A Lot of Text again here -> more illustration")
$ToggleCheckboxID = GUICtrlCreateCheckbox("Use Non-proportional Font", 10, 210, 180, 20)
GUICtrlCreateLabel ("Selecting the checkbox works fine." &@CRLF & @CRLF  & "Deselecting it does not get you back to the original font" & @CRLF & @CRLF & "Each time you toggle, the list box shrinks one line!",10,250,400,200)

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $ToggleCheckboxID
            If GUICtrlRead($ToggleCheckboxID) = $GUI_CHECKED Then
                GUICtrlSetFont($ListBoxID, -1, -1, -1, "Courier")
            Else
                GUICtrlSetFont($ListBoxID, -1, -1, -1, -1)
            EndIf
    EndSelect
WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0