PatL Posted May 31, 2008 Share Posted May 31, 2008 What do I need to do to both wrap and center the text in a button control? Thanks Link to comment Share on other sites More sharing options...
monoceres Posted May 31, 2008 Share Posted May 31, 2008 Or the styles: #include <buttonconstants.au3> GUICreate("Sample") GUICtrlCreateButton("Some text",10,10,50,50,BitOr($BS_CENTER ,$BS_MULTILINE)) GUISetState() Do $msg=GUiGetMsg() Until $msg=-3 Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PatL Posted May 31, 2008 Author Share Posted May 31, 2008 Or the styles: #include <buttonconstants.au3> GUICreate("Sample") GUICtrlCreateButton("Some text",10,10,50,50,BitOr($BS_CENTER ,$BS_MULTILINE)) GUISetState() Do $msg=GUiGetMsg() Until $msg=-3 Link to comment Share on other sites More sharing options...
PatL Posted May 31, 2008 Author Share Posted May 31, 2008 Thanks. I tried the code and added a long text string. It was still left justified as if I had simply used the $BS_MULTILINE style by itself. Link to comment Share on other sites More sharing options...
monoceres Posted May 31, 2008 Share Posted May 31, 2008 Thanks. I tried the code and added a long text string. It was still left justified as if I had simply used the $BS_MULTILINE style by itself.Are you saying it isn't looking like this on your computer? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PatL Posted May 31, 2008 Author Share Posted May 31, 2008 Yes. I wonder what is different on my computer Link to comment Share on other sites More sharing options...
PatL Posted June 1, 2008 Author Share Posted June 1, 2008 Is there a reason that "BitOr($BS_CENTER ,$BS_MULTILINE" will not center my text as it is supposed to? The text word wrapped but remains left justified. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 1, 2008 Moderators Share Posted June 1, 2008 Works fine for me:#include <GUIConstantsEx.au3> GUICreate("") GUICtrlCreateButton("this is my button" & @CRLF & "Click here", 10, 10, 200, 50, BitOR($BS_CENTER, $BS_MULTILINE)) GUISetState() While GUIGetMsg() <> -3 WEnd Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
monoceres Posted June 1, 2008 Share Posted June 1, 2008 That was what I said too, yesterday: http://www.autoitscript.com/forum/index.php?showtopic=72605 Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
PatL Posted June 1, 2008 Author Share Posted June 1, 2008 That was what I said too, yesterday: http://www.autoitscript.com/forum/index.php?showtopic=72605Right. I was hoping someone has an idea why it may be different on my system. I am running XP SP3 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 1, 2008 Moderators Share Posted June 1, 2008 (edited) Right. I was hoping someone has an idea why it may be different on my system. I am running XP SP3I'm ran it on XP Pro SP3 with no issues...Next time don't double post ... and you might want to take the time to think about what you are going to ask before you start typing ... if what you asked isn't what you really want to know. Edited June 1, 2008 by SmOke_N Merged topics Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dmob Posted June 2, 2008 Share Posted June 2, 2008 hi I am new to AutoIt and this forum and I am having a similar problem. I tried to center multiline text on a button control AND colour it and I am not having any success. I have tried using the styles and GUICtrlSetStyle and nothing works. BTW: That IS how we spell colour in SA. CODE $ButT10 = GUICtrlCreateButton($But10[2], 385, 240, 84, 49, $BS_MULTILINE+$BS_VCENTER) ;GUICtrlSetBkColor(-1, 0xB9F8AE) Link to comment Share on other sites More sharing options...
rasim Posted June 3, 2008 Share Posted June 3, 2008 Where a problem? #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Test GUI", 200, 100) $button = GUICtrlCreateButton("Button with" & @LF & "multiline text", 60, 40, 75, 40, BitOR($BS_MULTILINE, $BS_CENTER)) GUICtrlSetBkColor(-1, 0xB9F8AE) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
dmob Posted June 3, 2008 Share Posted June 3, 2008 Where a problem? #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> $hGUI = GUICreate("Test GUI", 200, 100) $button = GUICtrlCreateButton("Button with" & @LF & "multiline text", 60, 40, 75, 40, BitOR($BS_MULTILINE, $BS_CENTER)) GUICtrlSetBkColor(-1, 0xB9F8AE) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Sorry for the late reply, I'm in SA and our time zones... the problem is that the text on the button is read from a string inside an array, which in turn is read from a database. I cannot add the @LF coz I don't know what text will be in there. try this: $col2 = 0xB9F8AE $ButT10 = GUICtrlCreateButton($But10[2], 385, 240, 84, 49, BitOR($BS_MULTILINE, $BS_CENTER)) GUICtrlSetBkColor(-1, $col2) the text inside the string is 'Print Blk Text Colour Picture'. When not coloured the text is wrapped nicely and centred. As soon as I add the colour code, the text reverts back to single line AND jumps to the top of the button. Link to comment Share on other sites More sharing options...
rasim Posted June 4, 2008 Share Posted June 4, 2008 (edited) Create the Ownerdraw button. Example there is in help, see GUIRegisterMsg() function. Edited June 4, 2008 by rasim Link to comment Share on other sites More sharing options...
dmob Posted June 5, 2008 Share Posted June 5, 2008 Thank you, rasim, i will try that. Link to comment Share on other sites More sharing options...
gemineyez Posted August 4, 2008 Share Posted August 4, 2008 Since we are on the topic of centering, can someone tell me how to get my text in the variable ($author) to be centered. Basically i wrote an admin tool for techs at my work and I would like to have the about me info centered. So far my work around has been to use spaces in between the " ". Case $msg = $aboutitem Msgbox(0,"About", $me ) $Author = "IT Microsystems Technicians" & @LF & " Troubleshooting Tool" & @CRLF & " Version 1.2" & @CRLF & " Created by " & @LF & " Jason Morgan" $me = StringAddCR($Author) Go farther, go further, Go Harder,Is that not why we came?And if not then why bother? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now