AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUI radio button labels and system font size

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Boskoop



Joined: 01 Jan 2005
Posts: 71

PostPosted: Fri Aug 10, 2007 7:48 pm    Post subject: GUI radio button labels and system font size Reply with quote

The radio button labels become unreadable with with system font size bigger than standard:
The following code
Code:
gui, add, radio, , Yellow
gui, add, radio,  , Bluegreen
gui, add, radio,  , Violet
gui, show

gives a nice GUI with system font size 100% (96 dpi)


With a system font size of 110% (106 dpi)I get this:


When I specify the width of the label by changing the code
Code:
gui, add, radio, w80, Yellow
gui, add, radio, w80, Bluegreen
gui, add, radio, w80, Violet
gui, show

I get a readable GUI again:


I'm trying to avoid absolute sizing and positioning of controls in order to make the code more maintainable. I hoped too, GUIs without absolute sizing will show, no matter what the system font size.

Is it possible to fix this problem with radio buttons?

Thanks

Boskoop
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2381

PostPosted: Sat Aug 11, 2007 4:58 am    Post subject: Reply with quote

Have you tried setting the font size/type for the GUI?
Back to top
View user's profile Send private message Visit poster's website
Boskoop



Joined: 01 Jan 2005
Posts: 71

PostPosted: Sat Aug 11, 2007 9:17 am    Post subject: Reply with quote

Thanks for your answer. Have tried it with 110% system font size.
This provides some sort of workaround.

Font size and type has this effekt:

1. When using monospaced font types (I tried courier new, courier, lucida console), the label shows as it should with any font size

2. With font size 8 and larger (tried up to 12), the label shows. Any fontsize under 8 reproduces the problem when using proportional font types (verdana, arial, times new roman).

Checkbox labels show the same behaviour as radio button labels. AHK seems to produce some sort of line wrap. When specifying r2 as an option, one sees the last letter of the control label in an new line:

Quote:
gui, add, radio, r2 , BluegreenBluegreenBluegreen
gui, add, radio, r2 , Yellow
gui, add, radio, r2 , Violet
gui, show





Boskoop
Back to top
View user's profile Send private message
corrupt



Joined: 29 Dec 2004
Posts: 2381

PostPosted: Sat Aug 11, 2007 4:34 pm    Post subject: Reply with quote

Boskoop wrote:
2. With font size 8 and larger (tried up to 12), the label shows. Any fontsize under 8 reproduces the problem when using proportional font types (verdana, arial, times new roman).
This might be due to some fonts not supporting a size smaller than 8. If the font size you specify is not supported then the command might not have any effect and retain the previous size (not sure - you could maybe try checking ErrorLevel).
Back to top
View user's profile Send private message Visit poster's website
Boskoop



Joined: 01 Jan 2005
Posts: 71

PostPosted: Sun Aug 12, 2007 9:35 am    Post subject: Reply with quote

I don't think that non-supported font sizes are the problem:

1. Arial 8pt is supported (All word processors on my system offer this font-size), and it shows wrong in the GUI
2. Courier 4 isn't supported. The GUI shows correctly, using Courier 6.
3. I didn't find any error level related to font sizes or adding of controls in the documentation. Tried it anyway, and got an ErrorLevel of 0, no matter if the font was supported or not.

Not all monospaced fonts show correctly. I get the same problem using Courier New 5pt or less.

Is it possible that there is some fault in the algorithm that calculates the space demand of certain fonts/ font sizes/system font sizes? As there is no such problem in text fields, maybe it's something that could be fixed?

Boskoop
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Sat Aug 18, 2007 1:00 am    Post subject: Reply with quote

Sorry for the late reply. One solution might be the BS_MULTILINE style, which can be removed via the -Wrap setting. For example:
Code:
gui, add, radio, -Wrap, Violet

Please let me know if that helps.

Also, can anyone else reproduce the unwanted wrapping in the topmost post? I can't reproduce it by switching from 96 to 120 dpi.

AutoHotkey uses the WinAPI function DrawText() to calculate how wide the text will be. Maybe when you choose an unusual DPI (i.e. something other than 96 or 120), some kind of round-off problem occurs.

Here's a topic about a similar problem with checkboxes: http://www.autohotkey.com/forum/viewtopic.php?t=21332

Thanks.
Back to top
View user's profile Send private message Send e-mail
Boskoop



Joined: 01 Jan 2005
Posts: 71

PostPosted: Sat Aug 18, 2007 10:26 am    Post subject: Reply with quote

Thank you!
Code:
gui, add, radio, -Wrap, Violet
The -wrap option did the trick. As far as I could test it, it has no side effects on my GUI either. .

Quote:
I can't reproduce it by switching from 96 to 120 dpi.
I tried it once with 120 dpi, and couldn't reproduce it either. A restart takes a lot of time, so I didn't experiment too much with different system font sizes.

Quote:
Maybe when you choose an unusual DPI (i.e. something other than 96 or 120), some kind of round-off problem occurs.
I use 106 dpi (110%). A round-off problem seems plausible to me. I just wonder why it doesn't occur with text-controls.

I have downloaded a few rather nice AHK-applications (i.e. BBCodeWriter and AHK Window Info). Checkboxes and Radiobuttons in those applications don't show on my system either. Do you think a line about this problem and it's solution in the documentation might be useful?

Quote:
Sorry for the late reply.
A whole week! Really! Wink. But to be serious again: For me that was at lightning speed. And it worked. I'll never stop being amazed about quality and tempo of AHK-support that beats everything I know from commmercial software. Very Happy

Thanks again
Boskoop
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Sun Aug 19, 2007 5:41 pm    Post subject: Reply with quote

Boskoop wrote:
Thank you!
Code:
gui, add, radio, -Wrap, Violet
The -wrap option did the trick. As far as I could test it, it has no side effects on my GUI either. .
Your testing and confirmation helped me make the decision to omit the "wrapping" style from checkboxes and radio buttons when no width, height, or CR/LF characters are specified (this had already been done for buttons since v1.0.45). Although there's a slight chance this will break a few existing scripts, it seems worth it because you're at least the second person to report this problem (I suspect there are many others).

Quote:
I have downloaded a few rather nice AHK-applications (i.e. BBCodeWriter and AHK Window Info). Checkboxes and Radiobuttons in those applications don't show on my system either. Do you think a line about this problem and it's solution in the documentation might be useful?
Hopefully they'll display better under the next release. I've also added some documentation to the radio/checkboxes section to mention -Wrap.

Thanks for pointing out the problem so clearly.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group