Damein Posted November 3, 2010 Share Posted November 3, 2010 (edited) Alright, so I have a GUI with an edit box in it that I have descriptions, like a synopsis of a movie that is placed into the box when I press a button. Now, the problem is the text is obviously too long to fit on one line, so I need to break it up.Here are two examples that I have:The slick traveling salesman, Dr. Theron, promises to teach C.J. the secrets of success and fame. But C.J. must decide whom he wants to follow more, “the good doctor” or “The Good Shepherd.”C.J.’s dad, Theo is in for the legal battle of his life. As he struggles to do the right thing, he discovers that not only does the whole town want him to give up – so does C.J.!Now, I got the first one to work, because I was making the code customized to fit that info, but if I try the same thing on the second one it comes out wrong.Here is the first one:Which comes out exactly how I wanted it.But using the same code for the second one, I get this result:So!Here is the section of code I was using:$result = StringLeft($Var2[$i][1], 80) $result = $result & @CRLF & StringMid($var2[$i][1], 110, 70) $result = $result & @CRLF & StringMid($var2[$i][1],180,500)In order to split it.Thanks in advance, I'm sure theres an easier way to count the number of characters and split them. Edited November 3, 2010 by Damein Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 3, 2010 Share Posted November 3, 2010 I don't understand why you are doing this manually when the Edit control can autowrap the text for itself: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> Global $hGUI, $idEdit Global $aText[3] = ["The slick traveling salesman, Dr. Theron, promises to teach C.J. the secrets of success and fame. But C.J. must decide whom he wants to follow more, “the good doctor” or “The Good Shepherd.”", _ "C.J.’s dad, Theo is in for the legal battle of his life. As he struggles to do the right thing, he discovers that not only does the whole town want him to give up – so does C.J.!", _ "One more long line that will autowrap at the width of the current edit control."] $hGUI = GUICreate("My GUI edit", 300, 200) ; will create a dialog box that when displayed is centered $idEdit = GUICtrlCreateEdit("", 10, 10, 280, 100, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() For $n = 0 To UBound($aText) - 1 ControlSetText($hGUI, "", $idEdit, $aText[$n]) Sleep(5000) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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