jlf Posted January 29, 2016 Share Posted January 29, 2016 (edited) Hi, I need to create a text-area (I used GUICtrlCreateEdit) in which some text will be returned. The user should be able to vertical-scroll in this text-box but never be able to edit this text. In the attached script, if the user do a click inside this Edit, the next text will be inserted at this location (very very bad for me). So, I tryed to "GUI_DISABLE" this Edit. This solve the user-click problem, BUT the user is not anymore able to move the vertical scroll ! This line is line 26 in the script. (please see also comment just before in this script). Question : how to have a "valid" vertical scroll and always insert text at the end, even if user clicks somewhere ? Thanks in advance for your help JL test.au3 Edited January 29, 2016 by jlf Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 29, 2016 Moderators Share Posted January 29, 2016 jlf, How about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> Opt("GUIOnEventMode", 1) Local Const $WIDTH = 1000 Local Const $HEIGHT = 600 Local $i = 0 $hnd_gui = GUICreate("Title", $WIDTH, $HEIGHT) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") $CID_ctrl = GUICtrlCreateEdit("", 0, 0, $WIDTH - 3, $HEIGHT - 25, BitOR($ES_READONLY, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState() For $i = 1 To 10 GUICtrlSetData($CID_ctrl, GUICtrlRead($CID_ctrl) & StringFormat("Time Stamp #%d" & @CRLF, $i)) Next While $hnd_gui <> 0 GUICtrlSetData($CID_ctrl, GUICtrlRead($CID_ctrl) & StringFormat("Time Stamp #%d" & @CRLF, $i)) $i += 1 _GUICtrlEdit_Scroll($CID_ctrl, $SB_SCROLLCARET) Sleep(250) WEnd Func _GUI_Close() Exit EndFunc ;==>_GUI_Close Please ask if you have any questions. 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...
jlf Posted January 29, 2016 Author Share Posted January 29, 2016 Thanks M23. I tryed your code, but the text being added is in fact the output stream of a child process. This is expected to be a bit more than 1Mbyte. So I created a "dummy" string and AutoIt drastically slow down @ 256Kbytes. The problem is, in my opinion, that entire text is each time read and write again, instead of writing only the new part. I think the best way to start is activating the line with GUI_DISABLE and to solve the problem to NOT disable the vertical scroll. I don't know if this is "AutoIt-compatible". I tryed also the _GUICtrlEdit_InsertText, but the "caret" is still user selectable. So, perhaps another way to solve this : is it possible to disable the caret, and stuck it at the end ? Or disable mouse-click ? Thanks in advance JL Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 29, 2016 Moderators Share Posted January 29, 2016 jlf, Quote the text being added is in fact the output stream of a child process. This is expected to be a bit more than 1Mbyte Always helps to explain the problem fully from the start - then we do not waste time on easy, but ultimately useless suggestions. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> Opt("GUIOnEventMode", 1) Local Const $WIDTH = 1000 Local Const $HEIGHT = 600 Local $i = 0 $hnd_gui = GUICreate("Title", $WIDTH, $HEIGHT) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") $CID_ctrl = GUICtrlCreateEdit("", 0, 0, $WIDTH - 3, $HEIGHT - 25, BitOR($ES_READONLY, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState() While 1 _GUICtrlEdit_InsertText($CID_ctrl, StringFormat("Time Stamp #%d" & @CRLF, $i)) $i += 1 _GUICtrlEdit_Scroll($CID_ctrl, $SB_SCROLLCARET) Sleep(250) WEnd Func _GUI_Close() Exit EndFunc ;==>_GUI_Close 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...
jlf Posted February 1, 2016 Author Share Posted February 1, 2016 (re) Thanks M23. There is still the same problem. Please see attached "image1.png". If user do a click in this window, sometime, the text is inserted at this "wrong" caret position. I really think the problem is the user's ability to click in this text-area. If the user do a click between the two instructions "InsertText" & "Scroll", the new & bad caret position is used. I also tryed with a code varation, but this doesn't fix the issue. While $hnd_gui<>0 _GUICtrlEdit_Scroll($hnd_ctrl, $SB_SCROLLCARET) _GUICtrlEdit_InsertText($hnd_ctrl, StringFormat("Time Stamp #%d" & @CRLF,$i)) _GUICtrlEdit_Scroll($hnd_ctrl, $SB_SCROLLCARET) $i += 1 Sleep(500) WEnd Thanks in advance. JL Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2016 Moderators Share Posted February 1, 2016 jlf, I can make that happen very occasionally if I click incessantly in the edit - you must have some very assiduous clickers! So to prevent any clicking in the edit let us cover it with a transparent child GUI, leaving the scrollbar uncovered: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> Opt("GUIOnEventMode", 1) Local Const $WIDTH = 1000 Local Const $HEIGHT = 600 Local $i = 0 $hnd_gui = GUICreate("Title", $WIDTH, $HEIGHT) GUISetOnEvent($GUI_EVENT_CLOSE, "_GUI_Close") $CID_ctrl = GUICtrlCreateEdit("", 0, 0, $WIDTH - 3, $HEIGHT - 25, BitOR($ES_READONLY, $WS_VSCROLL, $ES_AUTOVSCROLL)) GUISetState() ; Create child GUI to cover edit control, less the scrollbar $hGUI_Child = GUICreate("", $WIDTH - 20, $HEIGHT - 25, 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hnd_gui) ; Make this GUI almost transparent WinSetTrans($hGUI_Child, "", 10) GUISetState() While 1 _GUICtrlEdit_Scroll($CID_ctrl, $SB_SCROLLCARET) _GUICtrlEdit_InsertText($CID_ctrl, StringFormat("Time Stamp #%d" & @CRLF, $i)) $i += 1 Sleep(250) ; If child GUI clicked, restore focus to main GUI If BitAnd(WinGetState($hGUI_Child), 8) Then WinActivate($hnd_gui) EndIf WEnd Func _GUI_Close() Exit EndFunc ;==>_GUI_Close How about that? 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...
jlf Posted February 1, 2016 Author Share Posted February 1, 2016 Thanks M23. This works fine !!!! JL Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2016 Moderators Share Posted February 1, 2016 jlf, Good - glad I could help. 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...
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