qwert Posted March 23, 2021 Posted March 23, 2021 Is there any setting that makes a vertical scroll bar "sticky"? What I mean is this: I use _GUIScrollBars_Generate() to add a vertical scroll bar to a RichEdit control (which has $ES_MULTILINE and $WS_VSCROLL set, of course). The scroll bar appears, whether or not the current number of lines in the control is less than or greater than the vertical size of the control ... which is what I expect. A problem occurs when I remove lines from the end of long displayed text. When the vertical threshold is crossed, Windows (I assume Windows) detects the shortening and removes the vertical scroll bar. The result is that word wrap causes text in the control to shift around ... which is not good for my use. I need for the scroll bar to "stick" ... be there through thick or thin. Is that possible? Thanks in advance for any help.
Nine Posted March 23, 2021 Posted March 23, 2021 You should know by now that providing a snippet of the issue you are facing would greatly help us to help you. Unless, someone has encountered the same exact problem and remembers the solution by heart, those who has not been previously in this situation will need to experiment... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
qwert Posted March 24, 2021 Author Posted March 24, 2021 expandcollapse popup; ; SIMPLIFIED example of a single RTF control with scrollbar ; #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <String.au3> #include <WinAPISysWin.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GUIMenu.au3> #include <WindowsConstants.au3> #Include <ScrollBarConstants.au3> #include <StaticConstants.au3> #include <GuiScrollBars.au3> #include <GuiRichEdit.au3> #include <GUIScrollbars_Ex.au3> $hGUI = GUICreate("Tabs with RichEdit transparent field", 500, 260) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 20, 40, 460, 200, BitOR($ES_MULTILINE, $WS_VSCROLL)) ;, $WS_EX_TRANSPARENT) GUICtrlCreateLabel("Removing 3 blank lines from the control causes the scroll bar to be removed.", 20, 12, 460, 22) ; set for no frame on RichEdit: Local $iExStyte = _WinAPI_GetWindowLong( $hRichEdit, $GWL_EXSTYLE ) - $WS_EX_CLIENTEDGE _WinAPI_SetWindowLong( $hRichEdit, $GWL_EXSTYLE, $iExStyte ) _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is text" & _StringRepeat(@CRLF, 16) ) _GUICtrlRichEdit_SetScrollPos($hRichEdit, 0, 0) Local $result = _GUIScrollBars_Generate($hRichEdit, 0, 200, 0, 0, False) If Not IsArray($result) Then MsgBox(0, "Scrollbar failed", @error) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit EndSwitch WEnd
pixelsearch Posted March 24, 2021 Posted March 24, 2021 15 hours ago, qwert said: I need for the scroll bar to "stick" ... be there through thick or thin. Is that possible? It's doable with the appropriate Rich Edit style : ... Global Const $ES_DISABLENOSCROLL = 0x2000 ; "Disables scroll bars instead of hiding them when they are not needed." (msdn) ... $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 20, 40, 460, 200, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_DISABLENOSCROLL)) ;, $WS_EX_TRANSPARENT) ... This Rich Edit control style isn't found in AutoIt help file and it's commented in EditConstants.au3, maybe because it has the same value as another Edit control style. This is how I added it in Yashied's script (now maintained by argumentum) : Global Const $Style_RichEdit[8][2] = _ ; will also use plenty (not all) of Edit styles [[0x01000000, 'ES_SELECTIONBAR'], _ [0x00400000, 'ES_VERTICAL'], _ ; Asian-language support only (msdn) [0x00080000, 'ES_NOIME'], _ ; ditto [0x00040000, 'ES_SELFIME'], _ ; ditto [0x00008000, 'ES_SAVESEL'], _ [0x00004000, 'ES_SUNKEN'], _ [0x00002000, 'ES_DISABLENOSCROLL'], _ ; same value as 'ES_NUMBER' => issue ? [0x00000008, 'ES_NOOLEDRAGDROP']] ; same value as 'ES_UPPERCASE' but RichRdit controls do not support 'ES_UPPERCASE' style (msdn) Professor_Bernd 1 "I think you are searching a bug where there is no bug..."
Nine Posted March 24, 2021 Posted March 24, 2021 $ES_NUMBER does not seem to work on RichEdit, maybe this is why that constant value was (re)used. Nice finding btw @pixelsearch “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Multi-Threading Made Easy
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