AutoHotkey Community

It is currently May 25th, 2012, 3:10 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: August 10th, 2007, 7:48 pm 
Offline

Joined: January 1st, 2005, 11:54 am
Posts: 75
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)
Image

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

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:
Image

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2007, 4:58 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
Have you tried setting the font size/type for the GUI?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2007, 9:17 am 
Offline

Joined: January 1st, 2005, 11:54 am
Posts: 75
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


Image


Boskoop


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2007, 4:34 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2541
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2007, 9:35 am 
Offline

Joined: January 1st, 2005, 11:54 am
Posts: 75
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2007, 1:00 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2007, 10:26 am 
Offline

Joined: January 1st, 2005, 11:54 am
Posts: 75
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! ;). 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. :D

Thanks again
Boskoop


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 19th, 2007, 5:41 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group