tkminh Posted December 3, 2010 Share Posted December 3, 2010 Hi everyone, I'm use <GuiRichEdit.au3>, and I want to create new GUIRICHEDIT, and it will show the line number. Please help me with this, thank first. Visit my blogMua bán ô tô, xe hơi, tuyển dụng việc làm Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 3, 2010 Moderators Share Posted December 3, 2010 tkminh, Easy when you know how! expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $lblMsg, $hRichEdit Global $sText = "ASDF fj aslfj skldjf lkdsjf jaskdjf lsjdfldsjflasldsjf llskjlg fsdfsdffdsdsfghjf lskjdf lskdjf lskdjflkjlg ashd" & @CRLF & _ "ABC" & @CRLF & _ "ASDF fj aslfj skldjf lkdsjf jaskdjf lsjdfldsjflasldsjf llskjlg fsdfsdffdsdsfghjf lskjdf lskdjf lskdjflkjlg ashd" & @CRLF & _ "ABC" & @CRLF & _ "ASDF fj aslfj skldjf lkdsjf jaskdjf lsjdfldsjflasfj asldj fdsjf ldsjffdsdsfghjf lskjdf lskdjf lskdjflkjlg ashd" & @CRLF & _ "ABC" & @CRLF & _ "ASDF fj aslfj skldjf lkdsjf jaskdjf lsjdfldsjflasfj asldj fdsjf ldsjffdsdsfghjf lskjdf lskdjf lskdjflkjlg ashd" & @CRLF & _ "ABC" & @CRLF & _ "ASDF fj aslfj skldjf lkdsjf jaskdjf lsjdfldsjflasfj asldj fdsjf ldsjffdsdsfghjf lskjdf lskdjf lskdjflkjlg ashd" Main() Func Main() Local $hGui = GUICreate("RichEdit Line Finder", 320, 300) Local $hRichEdit = _GUICtrlRichEdit_Create($hGui, $sText, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) Local $hButton = GUICtrlCreateButton("Get Line", 10, 250, 80, 30) Local $hLabel = GUICtrlCreateLabel("", 100, 250, 85, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $hButton Local $iLine = ControlCommand($hGUI, "", $hRichEdit, "GetCurrentLine", "") GUICtrlSetData($hLabel, $iLine) _WinAPI_SetFocus($hRichEdit) EndSwitch WEnd EndFunc M23 pixelsearch 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...
tkminh Posted December 3, 2010 Author Share Posted December 3, 2010 Thank for your reply. But it not correct with my expected. :-( My meaning is display the line number in GuiRichEdit,like "SciTE Script Editor", the text editor display line number for each line when you typing. Anyway, thank you so much for your reply. Visit my blogMua bán ô tô, xe hơi, tuyển dụng việc làm Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 3, 2010 Moderators Share Posted December 3, 2010 tkminh, I showed you how to get the line number and now you want me to write a script to show you how to do exactly what you want? That is not how it works around here - I have shown you how to get the line, it is up to you to incorporate that into your script. I am not writing a whole script for you. You have a go yourself first and see how you get on. When you run into problems, then show us what you have tried and we will take a look at the code. Good luck! M23 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...
Mat Posted December 3, 2010 Share Posted December 3, 2010 (edited) It's quite difficult, and there is no one way to go about it. The first way is to embed the scite editor using Scilexer.dll (search on the forums) The second is to Use a seperate control next to it (Harder than it sounds) The third is owner drawing the richedit control. Edited December 3, 2010 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
James Posted December 3, 2010 Share Posted December 3, 2010 It's quite difficult, and there is no one way to go about it.The first way is to embed the scite editor using Scilexer.dll (search on the forums)The second is to Use a seperate control next to it (Harder than it sounds)The third is owner drawing the richedit control.Erm Mat, he doesn't want the Scintilla control embeded, he just wants line numbers like SciTE does. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 3, 2010 Moderators Share Posted December 3, 2010 Mat,It's quite difficultI am not sure I agree. If all the OP wants are simple labels on his GUI showing where the cursor is in his RichEdit control, it is 2 ControlCommand lines and 2 GUICtrlSetData lines in a loop with a bit of anti-flickering checking. That is why I suggested he have a go. I do not think he is looking to replicate SciTE. M23 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...
tkminh Posted December 3, 2010 Author Share Posted December 3, 2010 Thanks all, I will try. Visit my blogMua bán ô tô, xe hơi, tuyển dụng việc làm Link to comment Share on other sites More sharing options...
Mat Posted December 3, 2010 Share Posted December 3, 2010 (edited) I was under the impression he wanted line numbering on the side of the edit control... Is that not correct? If so then embedding scintilla is probably one of the easiest ways If he is trying to make a status bar with line number info then there are better ways (but more complex) than what Melba is suggesting, In this case I wouldn't bother though since it's a real pain (even more so than normal messages IMHO).+Edit: Lets just clarify what the OP wants...A rich edit with line numbers for each line at the side: 1 This is the rich edit text 2 And on the second line 3 And a third 4 5 Etc. Etc.A rich edit with a bar at the bottom with information such as line number. This is the rich edit text And on the second line And a third| Etc. Etc - - - - - - - - - - - - - - - - - - - - - Line: 3 Col: 11 Edited December 3, 2010 by Mat AutoIt Project Listing 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