Hypertrophy Posted June 20, 2009 Share Posted June 20, 2009 what command do i use to make the text in my edit word wrap itself. my edit is multiline but also re-sizeable so if it is sized to a certain position then when text reaches the end how to make it go to next line? thanks. Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 what command do i use to make the text in my edit word wrap itself. my edit is multiline but also re-sizeable so if it is sized to a certain position then when text reaches the end how to make it go to next line? thanks.You need to remove the styles $ES_AUTOHSCROLL and $WS_HSCROLL. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 You need to remove the styles $ES_AUTOHSCROLL and $WS_HSCROLL.the only style that was in there was $ES_AUTOHSCROLL. $WS_HSCROLL was not there.but i removed $ES_AUTOHSCROLL and didnt work. Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 the only style that was in there was $ES_AUTOHSCROLL. $WS_HSCROLL was not there. but i removed $ES_AUTOHSCROLL and didnt work. You need to post the line where you create the edit or set the styles. Don't forget that the following style are put as defaults in unless you set them otherwise $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 413, 298, 303, 219) $Edit1 = GUICtrlCreateEdit("", 56, 40, 185, 89, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd llc 1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 You need to post the line where you create the edit or set the styles. Don't forget that the following style are put as defaults in unless you set them otherwise $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Form3", 413, 298, 303, 219) $Edit1 = GUICtrlCreateEdit("", 56, 40, 185, 89, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL)) GUICtrlSetData(-1, "Edit1") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) thats what you meant in bold right? ^^^ Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) thats what you meant in bold right? ^^^ That does what you want doesn't it? Otherwise I might have misunderstood what you want. Xandy 1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 (edited) I think you misunderstood (my fault). When I type anything into the edit I want it to go to the next line automatically when the text reaches the end of the edit. like in notepad you can have notepad sized any size but when the text reaches the end it goes to the next line. Edited June 20, 2009 by coder09 Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 I think you misunderstood. When I type anything into the edit I want it to go to the next line automatically when the text reaches the end of the edit. like in notepad you can have notepad sized anyway but when the text reaches the end it goes to the next line.That's exactly what your code does for me. An if I have a gui with $WS_SIZEBOX and I resize the gui and hence the edit, then the text is automatically rearranged. Do you mean that when you run the example I posted that the text doesn't automatically wrap when you type lots of words in it? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 That's exactly what your code does for me. An if I have a gui with $WS_SIZEBOX and I resize the gui and hence the edit, then the text is automatically rearranged. Do you mean that when you run the example I posted that the text doesn't automatically wrap when you type lots of words in it? No, the text doesn't automatically wrap when I type lots of words in it. Here is my code so there is no confusion (its the same thing you gave me) expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <GUIMENU.au3> Global $idDelete[6], $idSave[6], $idInfo[6] For $i = 0 To 5 $idDelete[$i] = 1000 + $i $idSave[$i] = 1010 + $i $idInfo[$i] = 1020 + $i Next Global $wProcOld Global $lastdragIP = -1 Dim $hInput_GUI[50], $Input[50], $wProcsOld[6], $InputMenu[6], $hMenu[6], $idDelete[6], $idSave[6], $ifInfo[6] Dim $button $gui = GUICreate("", 400, 400) $button = GUICtrlCreateButton("", 50, 50, 50, 20) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $toDelete = 0 $iW = -1 Global $totCreated = 0 While 1 $msg = GUIGetMsg(1) $iW = -1 For $i = 0 To 5 If $msg[1] = $hInput_GUI[$i] Then $iW = $i If $msg[0] = $GUI_EVENT_PRIMARYDOWN Then $sel = -1 GUISwitch($hInput_GUI[$iW]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop $aMouse_Pos = MouseGetPos() $aInputGUI_Pos = WinGetPos($hInput_GUI[$iW]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$iW], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndIf ExitLoop EndIf Next If $iW >= 0 Or $msg[1] = $gui Then Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $button If $totCreated < 6 Then For $i = 0 To 5 If $hInput_GUI[$i] = 0 Then createNextdragIP($i) $totCreated += 1 ExitLoop EndIf Next Else MsgBox(262144, "MAX Reached", "You are omnly allowed 6 Edits!") EndIf EndSwitch EndIf WEnd DllCallbackFree($wProcHandle) Func createNextdragIP($nw) $start = WinGetPos($gui) $hInput_GUI[$nw] = GUICreate("No. " & $nw + 1, 120, 22, 300 + 25 * $nw, 300 + 25 * $nw, BitOR($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOOLWINDOW) $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $hMenu = _GUICtrlMenu_CreatePopup() $InputMenu[$nw] = $hMenu _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idDelete[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo[$nw]) ConsoleWrite("90" & @CRLF) GUISetState() $wProcsOld[$nw] = _WinAPI_SetWindowLong(GUICtrlGetHandle($Input[$nw]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) EndFunc ;==>createNextdragIP Func _WindowProc($hWnd, $msg, $wParam, $lParam) Local $wProcOld For $i = 0 To UBound($Input) - 1 If GUICtrlGetHandle($Input[$i]) = $hWnd Then Switch $msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($InputMenu[$i], $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idDelete[$i] ConsoleWrite("delete" & @CRLF) GUIDelete($hInput_GUI[$i]) $hInput_GUI[$i] = 0 $totCreated -= 1 Case $idSave[$i] ConsoleWrite("-> Save" & @LF) Case $idInfo[$i] ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch $wProcOld = $wProcsOld[$i] ExitLoop EndIf Next Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc ;==>_WindowProc Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 No, the text doesn't automatically wrap when I type lots of words in it. Here is my code so there is no confusion (its the same thing you gave me) expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <GUIMENU.au3> Global $idDelete[6], $idSave[6], $idInfo[6] For $i = 0 To 5 $idDelete[$i] = 1000 + $i $idSave[$i] = 1010 + $i $idInfo[$i] = 1020 + $i Next Global $wProcOld Global $lastdragIP = -1 Dim $hInput_GUI[50], $Input[50], $wProcsOld[6], $InputMenu[6], $hMenu[6], $idDelete[6], $idSave[6], $ifInfo[6] Dim $button $gui = GUICreate("", 400, 400) $button = GUICtrlCreateButton("", 50, 50, 50, 20) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $toDelete = 0 $iW = -1 Global $totCreated = 0 While 1 $msg = GUIGetMsg(1) $iW = -1 For $i = 0 To 5 If $msg[1] = $hInput_GUI[$i] Then $iW = $i If $msg[0] = $GUI_EVENT_PRIMARYDOWN Then $sel = -1 GUISwitch($hInput_GUI[$iW]) $aCursorInfo = GUIGetCursorInfo() If Not IsArray($aCursorInfo) Then ContinueLoop $aMouse_Pos = MouseGetPos() $aInputGUI_Pos = WinGetPos($hInput_GUI[$iW]) While IsArray($aCursorInfo) And $aCursorInfo[2] = 1 $aCursorInfo = GUIGetCursorInfo() $aCurrent_Mouse_Pos = MouseGetPos() WinMove($hInput_GUI[$iW], "", _ $aInputGUI_Pos[0] - $aMouse_Pos[0] + $aCurrent_Mouse_Pos[0], _ $aInputGUI_Pos[1] - $aMouse_Pos[1] + $aCurrent_Mouse_Pos[1]) WEnd EndIf ExitLoop EndIf Next If $iW >= 0 Or $msg[1] = $gui Then Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $button If $totCreated < 6 Then For $i = 0 To 5 If $hInput_GUI[$i] = 0 Then createNextdragIP($i) $totCreated += 1 ExitLoop EndIf Next Else MsgBox(262144, "MAX Reached", "You are omnly allowed 6 Edits!") EndIf EndSwitch EndIf WEnd DllCallbackFree($wProcHandle) Func createNextdragIP($nw) $start = WinGetPos($gui) $hInput_GUI[$nw] = GUICreate("No. " & $nw + 1, 120, 22, 300 + 25 * $nw, 300 + 25 * $nw, BitOR($WS_POPUP, $WS_SIZEBOX), $WS_EX_TOOLWINDOW) $Input[$nw] = GUICtrlCreateEdit("", 0, 0, 120, 22, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN)) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) $hMenu = _GUICtrlMenu_CreatePopup() $InputMenu[$nw] = $hMenu _GUICtrlMenu_AddMenuItem($hMenu, "Delete", $idDelete[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave[$nw]) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo[$nw]) ConsoleWrite("90" & @CRLF) GUISetState() $wProcsOld[$nw] = _WinAPI_SetWindowLong(GUICtrlGetHandle($Input[$nw]), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) EndFunc;==>createNextdragIP Func _WindowProc($hWnd, $msg, $wParam, $lParam) Local $wProcOld For $i = 0 To UBound($Input) - 1 If GUICtrlGetHandle($Input[$i]) = $hWnd Then Switch $msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($InputMenu[$i], $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idDelete[$i] ConsoleWrite("delete" & @CRLF) GUIDelete($hInput_GUI[$i]) $hInput_GUI[$i] = 0 $totCreated -= 1 Case $idSave[$i] ConsoleWrite("-> Save" & @LF) Case $idInfo[$i] ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch $wProcOld = $wProcsOld[$i] ExitLoop EndIf Next Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc;==>_WindowProcIf I run that script, create an edit by clicking the button and type lots of words into the new edit then it automatically wraps. I know that you're using a recent version of AutoIt but what OS do you have? I don't understand why the edit should not behave the same for both of us. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 running win xp home edition. hmmm...when you say it automatically "wraps" do you mean the edit is actually getting "taller" and the text appears on the next line (so the edit is now 2 lines tall instead of just one?) Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 running win xp home edition. hmmm...when you say it automatically "wraps" do you mean the edit is actually getting "taller" and the text appears on the next line (so the edit is now 2 lines tall instead of just one?)Yes, if I keep typing lots of words and using using the enter key then the number of lines in th eedit increases each time I get to the right-hand side of the edit.But I had dragged the edit first to increase its size. Do you mean that you want the edit to increase in size automatically as you add lines? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Hypertrophy Posted June 20, 2009 Author Share Posted June 20, 2009 Yes, if I keep typing lots of words and using using the enter key then the number of lines in th eedit increases each time I get to the right-hand side of the edit.But I had dragged the edit first to increase its size. Do you mean that you want the edit to increase in size automatically as you add lines?Ahhhh I see. This is fine, you've been a great help martin. Thank you. 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