Jump to content

two lines on a button


Bert
 Share

Recommended Posts

I made a example script to show what I'm attempting:

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Button1" & @CRLF & "test", 30, 30, 160, 70)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I want the button to be displayed so it says "button 1" above the word "test", instead of in one line, which it does now. Any ideas? I could do a pic, but I like to stay away from that, for I want to be able to change the text of the button depending on how a ini setting is configured.

Edit:I also know I can use $BS_MULTILINE, but that won't do what I want. I need to set what text is on each line, not just have it wrap

Edited by vollyman
Link to comment
Share on other sites

I came up with this, but the second line is to the left. I need that line to be centered also. The second line will have the variable text, so using spaces won't do it.

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Button1" & @CRLF & "test", 30, 30, 150, 70, $BS_CENTER + $BS_MULTILINE)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Button1" & @CRLF & "test", 30, 30, 160, 70, $BS_MULTILINE)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
       ;;;
    EndSelect
WEnd
Exit


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

does the same thing. It will put the word "test" to the left, at the same indent as the word "button". How do I make the word "test" be centered on the button?

example of what it is doing now:

Example of what I want it to do:

Edited by vollyman
Link to comment
Share on other sites

Strange, they are both centred on my computer.

Running latest release on win xp pro sp2

Edit - typo

Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

odd. I have SP2, and ...wait...let me update with the latest beta.

edit...nope...still happening..

anyone else tried the example to see if it works? It may just be my PC

I have Windows 2003 Server SP1, same as yours.

Link to comment
Share on other sites

I have figured out what the problem is. If I change to Windows classic theme I get the same as you but using the Windows XP theme I get it centred. I do not know how to fix it so that it is the same for both.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Looks like that is the problem... weird. I'm running WinXP SP2 with XP theme and its centered.

Edit: what about $BS_CENTER? From the help file - "Centers the text horizontally in the button rectangle." I tried switching to classic to test it, but it stayed the same even without the $BS_CENTER... I didn't restart though.

Edited by BPBNA
Link to comment
Share on other sites

Hi,

XP SP1 Theme XP centered!

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...