Mingre Posted September 11, 2015 Share Posted September 11, 2015 Hello, is there a way to make an edit control like that in SciTe? Thank you! Link to comment Share on other sites More sharing options...
Surya Posted September 11, 2015 Share Posted September 11, 2015 Yes _GUICtrlRichEdit would do that you could also colour specific words using richedit give a look on the help file for further informtion.for more help feel free to ask No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Mingre Posted September 11, 2015 Author Share Posted September 11, 2015 Hello, I searched thru the help file about RichEdit but didn't find what I've been looking for. Or if I missed it, will you direct me to the function you're referring? Thanks. Link to comment Share on other sites More sharing options...
Surya Posted September 11, 2015 Share Posted September 11, 2015 #include <GuiRichEdit.au3>_GUICtrlRichEdit_Create ( $hWnd, $sText, $iLeft, $iTop [, $iWidth = 150 [, $iHeight = 150 [, $iStyle = -1 [, $iExStyle = -1]]]] ) Examplein the help file:#include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text") GUISetState(@SW_SHOW) While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit EndSelect WEnd EndFunc ;==>Examplemay i know what exactly you want.Are you trying to make an editor like scite No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Mingre Posted September 11, 2015 Author Share Posted September 11, 2015 Hello, sorry If I wasn't clear but this is what I would like to do. Link to comment Share on other sites More sharing options...
Surya Posted September 12, 2015 Share Posted September 12, 2015 (edited) so you want to embedd a number list to an edit control? Try creating a new gui over the first one which has the number controls. Edited September 12, 2015 by Surya No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 12, 2015 Moderators Share Posted September 12, 2015 (edited) mingre,This is how I did it some years ago:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> ;Global $bEditMode = True Global $iLineCount = 0 ; Keep a global count so we can check if it has changed $hGUI = GUICreate("Test", 200, 200) $cEdit_Num = GUICtrlCreateEdit("", 10, 13, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) $cEdit_Main = GUICtrlCreateEdit("", 36, 10, 96, 175) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 10, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUISetState(@SW_SHOW) AdlibRegister("_LineNum", 100) $sStuff = "" For $i = 1 To 20 GUICtrlSetData($cEdit_Main, "Blah " & $i & @CRLF, 1) Sleep(250) Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($cEdit_Main) ;Check if the number of lines has changed in $cEdit_Main ;since this function was last called If $iCount <> $iLineCount Then ;save the new count to the global variable $iLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($cEdit_Num) If $iLineCount > $iNumCount Then For $i = $iNumCount + 1 To $iLineCount _GUICtrlEdit_AppendText ($cEdit_Num, @CRLF & $i) Next ElseIf $iLineCount < $iNumCount Then $text = GUICtrlRead($cEdit_Num) For $i = $iNumCount To $iLineCount + 1 Step -1 $text = StringReplace($text,@CRLF & $i,"") Next GUICtrlSetData($cEdit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($cEdit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFuncI will look at how I might update the code to use a message handler rather than Adlib.M23Edit: And here it is:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> ; Create flag $bEditChanged = False Global $iLineCount = 0 ; Keep a global count so we can check if it has changed $hGUI = GUICreate("Test", 200, 200) $cEdit_Num = GUICtrlCreateEdit("", 10, 13, 25, 165, BitOR($ES_AUTOVSCROLL, $ES_READONLY), 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetData(-1, "1") GUICtrlSetBkColor(-1, 0xC0DCC0) $cEdit_Main = GUICtrlCreateEdit("", 36, 10, 96, 175) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM) GUICtrlCreateLabel("", 10, 164, 25, 11) GUICtrlSetBkColor(-1, 0xC0DCC0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") ; Example code only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iNewLine = 1 $nBegin = TimerInit() ; End of example code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; If flag set If $bEditChanged Then ; Adjust numbering if required _LineNum() ; Clear flag $bEditChanged = False EndIf ; Example code only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; Add 20 lines - once every 250 msecs If TimerDiff($nBegin) > 250 And $iNewLine < 20 Then ; Add a line to show it working GUICtrlSetData($cEdit_Main, "Blah " & $iNewLine & @CRLF, 1) ; Increase count $iNewLine += 1 ; Reset timer $nBegin = TimerInit() EndIf ; End of example code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from the edit If _WinAPI_HiWord($wParam) = $EN_CHANGE And _WinAPI_LoWord($wParam) = $cEdit_Main Then ; Set the label to the new data $bEditChanged = True EndIf EndFunc ;==>_WM_COMMAND Func _LineNum() ; line numbering Local $iCount = _GUICtrlEdit_GetLineCount ($cEdit_Main) ;Check if the number of lines has changed in $cEdit_Main ;since this function was last called If $iCount <> $iLineCount Then ;save the new count to the global variable $iLineCount = $iCount Local $iNumCount = _GUICtrlEdit_GetLineCount ($cEdit_Num) If $iLineCount > $iNumCount Then For $i = $iNumCount + 1 To $iLineCount _GUICtrlEdit_AppendText ($cEdit_Num, @CRLF & $i) Next ElseIf $iLineCount < $iNumCount Then $text = GUICtrlRead($cEdit_Num) For $i = $iNumCount To $iLineCount + 1 Step -1 $text = StringReplace($text,@CRLF & $i,"") Next GUICtrlSetData($cEdit_Num, $text) EndIf EndIf Local $iFirstVisMain = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Main) Local $iFirstVisNum = _GUICtrlEdit_GetFirstVisibleLine ($cEdit_Num) If $iFirstVisMain <> $iFirstVisNum Then _GUICtrlEdit_LineScroll($cEdit_Num, 0, $iFirstVisMain - $iFirstVisNum) EndIf EndFunc Edited September 12, 2015 by Melba23 Mingre 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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