Sign in to follow this  
Followers 0
flyingboz

GUIDefaultFont()

4 posts in this topic

#1 ·  Posted (edited)

When creating labels and assigning such (font weight, italic, underline), I call GUIDefaultFont(), then GUISetControl(), and then GUIDefaultFont() again to reset the values prior to creating additional controls. However, when I leave one section of code (independently tested/verified to be working) and begin creating additional controls, I get a GUI wherein ALL controls show as having the 'underlined' attribute -- the last case that would be encountered as the code runs through the loop. Code snippet follows.

This yields two questions:

1) How do I <properly> reinitialize GUIDefaultFont() to system defaults?

2) How on earth can I have a situation where an already created control, which is never again referenced (haven't written the code) POSSIBLY be being reset?

for $j = 5 To 7
;Choose what font settings to use for control
         Select
         case $style_attributes[$j] = 'bold'
            GUIDefaultFont($fontSize,$fontWeight * 2)
         case $style_attributes[$j] = 'italics'
            GuiDefaultFont($fontsize,-1,-1,2)
            case $style_attributes[$j] = 'underlined'
            GuiDefaultFont($fontsize,-1,-1,4)
            
         EndSelect
        ;create control
            $control_array[0][$j] = GUISetControl("label", $style_attributes[$j], 110 + $row_header_separation * ($j - 5), 20, $wlabel)
;re-initialize default font settings...
         GuiDefaultFont($fontsize,$fontweight,-1,1)
      Next
Edited by flyingboz

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites



UPDATE: After further review, this appears NOT to be related to GUIDefaultFont(), but rather some type of GUI Refresh Issue - when creating additional controls, I see portions of the GUI Screen blacked out after creation w/ expected attributes. After focus reset, all characters are back, but all attributes are "lost" on the redraw.

I inserted big sleeps and did screen captures to demonstrate: This is just after the code snippet, (with a focus refresh)

when additional controls have been created, (with focus refresh)


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

What do you mean with "some type of GUI Refresh Issue"?

I only take a short look at your script part but why do not use "GUISetControlFont"?

Maybe you could/should try:

"GuiDefaultFont($fontsize,$fontweight,"",0)"

Edited by Holger

Share this post


Link to post
Share on other sites

Primarily becuase I did not notice it - I saw the defaultfont, and its usage seemed to indicate that it would do the job... Thx for the tip --- My "refresh" issue was due to a logic error, where I was trying to overwrite controls -- Problem solved, thx for the pointer.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

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