Jump to content
Sign in to follow this  
Aprilgogo

How to draw a column of text on a button?

Recommended Posts

Aprilgogo

Hi,

I was using GUICtrlCreateButton() to draw an onscreen keyboard, in which every button stands for a key. Usually the key "1" has "!" in the upper side and "1" in the bottom. So I tried:

$KEY_1 = GUICtrlCreateButton("!"&@CRLF&"1", ...)

But it didn't work. Actually it showed just "!1". Could someone please tell me how to make it work or some better ways to draw an onscreen keyboard? Thank you!

Share this post


Link to post
Share on other sites
ProgAndy

You have to add the Style

$BS_MULTILINE 0x2000 Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
Aprilgogo

You have to add the Style

$BS_MULTILINE 0x2000 Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

Yes, it works! Here's the code:

$KEY_1 = GUICtrlCreateButton(" !    1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

Share this post


Link to post
Share on other sites
Aprilgogo

Yes, it works! Here's the code:

$KEY_1 = GUICtrlCreateButton(" !    1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

Just got it, a better way:

$KEY_1 = GUICtrlCreateButton("!" & @CRLF     & "1", ...)
    GUICtrlSetStyle($KEY_1, $BS_MULTILINE)

Thank you!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.