mike1950r Posted June 20, 2023 Author Share Posted June 20, 2023 sorry again. as said didn't find a way to reinstall wordpad. btw we have 5 computers and on every computer wordpad and autoit richedit have the same error. i cannot imagine that this should be be a broken wordpad. is there no other way to verify and find out where the problem comes from. what dlls are responsible for enabling richedit for autoit? thanks for assistance cheers mike Link to comment Share on other sites More sharing options...
Andreik Posted June 20, 2023 Share Posted June 20, 2023 You should be able to install WordPad using dism. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
mike1950r Posted June 20, 2023 Author Share Posted June 20, 2023 9 minutes ago, Andreik said: You should be able to install WordPad using dism. Hi Andreik, what is dism? cheers mike Link to comment Share on other sites More sharing options...
Andreik Posted June 20, 2023 Share Posted June 20, 2023 Google is your friend. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
mike1950r Posted June 20, 2023 Author Share Posted June 20, 2023 1 hour ago, Andreik said: Google is your friend. my friend is my girlfriend 😉 cheers mike Link to comment Share on other sites More sharing options...
mike1950r Posted June 24, 2023 Author Share Posted June 24, 2023 (edited) Any other suggestions? 😕 Edited June 25, 2023 by mike1950r Link to comment Share on other sites More sharing options...
pixelsearch Posted June 25, 2023 Share Posted June 25, 2023 Mike, you could deactivate the horizontal scroll right arrow as soon as the horizontal scroll thumb has reached its very rightmost position, as shown in the pic below : After that, a click on the horizontal scroll thumb won't reactivate the arrow, but any other click on the horizontal scrollbar will (including dragging the thumb a bit on the left) with at least the letter "z" disappearing from the window ("z" is the very last letter of the longest line in the pic). Now that the scroll right arrow reappears (and at least the "z" is missing) then clicks on the self-reactived right arrow will be allowed...until the horizontal scroll thumb reaches its rightmost position again etc... The picture above is based on a reworked example of the help file, topic _GUIScrollBars_GetScrollBarRGState, with _GUIScrollBars_Init() applied to the (Rich)Edit control and not to the GUI.@PsaltyDS indicated in this link how to catch an event scrolling in _GUICtrlRichEdit ( WM_NOTIFY => $EN_MSGFILTER => PsaltyDS's "Case 276" e.g. $WM_HSCROLL, also you can prevent scrolling within the function by Returning 1 [tested] ) and there are also a few recommandations from @water and @Zedna in this link I guess there must be a way to detect the rightmost position of the horizontal scroll thumb (e.g. there is nothing to scroll anymore). As soon as you retrieve this position, then you should reach your goal. All this isn't really easy but as this issue seems crucial for you, then I hope you'll find the solution (with the help of other readers too) Good luck Link to comment Share on other sites More sharing options...
mike1950r Posted June 26, 2023 Author Share Posted June 26, 2023 pixelsearch, thanks. this sounds really good. i will try this. cheers mike Link to comment Share on other sites More sharing options...
mike1950r Posted June 26, 2023 Author Share Posted June 26, 2023 Hi again, I have integrated the code so far, that I get the current scroll positions. What I need and didn't find yet is how to get the max scroll positions possible. Then I can compare both positions and either disable the arrow or set the position back into the allowed range. Since the arrow sets by step, I would just reset to recent step. This is my idea. thanks for assistance Cheers mike Link to comment Share on other sites More sharing options...
pixelsearch Posted June 26, 2023 Share Posted June 26, 2023 Mike, I'll try to dig into that when I got some time. In fact, _GUIScrollBars_Init() isn't useful in the preceding pic. It is used in the help file (topic _GUIScrollBars_GetScrollBarRGState) to add scrollbars to the GUI (setting internally the elements of the Global variable $__g_aSB_WindowInfo[1][8], variable which will be found only in the function _GUIScrollBars_SetScrollInfoPos() and nowhere else in AutoIt) As the (Rich)Edit control already got scrollbars, then we don't need _GUIScrollBars_Init() in your case, maybe a function like _GUIScrollBars_GetScrollBarXYThumbBottom() would be a good start, as it "retrieves the position of the bottom or right of the thumb" Link to comment Share on other sites More sharing options...
pixelsearch Posted June 26, 2023 Share Posted June 26, 2023 Mike, maybe some good news : * The rightmost horizontal scroll thumb position is found in xyThumbBottom (see structure $tagSCROLLBARINFO in help file). It should be a constant, as long as the (rich)edit control isn't resized. * The changing position of the horizontal scroll thumb (its right coordinate) is found in GUIScrollBars_GetScrollBarXYThumbBottom . It changes constantly when a horizontal scrolling event is done. So comparing both values when a richedit horizontal scroll event appears (in WM_NOTIFY => $EN_MSGFILTER => etc...) should allow you to deactivate the horizontal scroll arrow as soon as both values are equal. Link to comment Share on other sites More sharing options...
mike1950r Posted June 26, 2023 Author Share Posted June 26, 2023 (edited) hi pixelsearch, thanks for the info. Here GUIScrollBars_GetScrollBarXYThumbBottom does not change the value while scrolling. It always is same value like xyThumbBottom. A variable scroll position I get with  _GUICtrlRichEdit_GetScrollPos($hGlo_WE_Control) but the value seems to be like line length (117) and not like the most position (1254) In fact i need to compare editcontrol content width (say respecting longest line) with editcontrol width opened more than this content by faulty scrolling with the arrow. Cheers mike Edited June 26, 2023 by mike1950r Link to comment Share on other sites More sharing options...
mike1950r Posted June 26, 2023 Author Share Posted June 26, 2023 I have a video concerning this problem, it's just from wordpad, but it is the same problem cheers mike Link to comment Share on other sites More sharing options...
Solution pixelsearch Posted June 26, 2023 Solution Share Posted June 26, 2023 Mike, the following script solves partially your issue. If you immediately drag the horizontal scroll box at its rightmost position, then the horizonal scroll right arrow will be deactivated, as discussed before. But this is not enough, as some other ways of scrolling aren't solved by the script.expandcollapse popup #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <GuiScrollBars.au3> Global $sText = "", $hGui, $hRichEdit For $n = 2 To 100 $sText &= $n & " - This is a single long line intended to cause a hoizontal scroll bar to appear in the RichEdit control." & @CRLF Next $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, $sText, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL)) ; _GUICtrlRichEdit_SetEventMask($hRichEdit, BitOR($ENM_SCROLL, $ENM_SCROLLEVENTS)) _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_SCROLLEVENTS) GUISetState(@SW_SHOW) $tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hRichEdit, $OBJID_HSCROLL) $iMaxScrollHoriz = $tSCROLLBARINFO.Right - $tSCROLLBARINFO.xyThumbTop - $tSCROLLBARINFO.Left ConsoleWrite("$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf & @crlf) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam) #forceref $iMsg, $iWparam Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu $tNMHDR = DllStructCreate($tagNMHDR, $iLparam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hRichEdit Select Case $iCode = $EN_MSGFILTER $tMsgFilter = DllStructCreate($tagMSGFILTER, $iLparam) Switch DllStructGetData($tMsgFilter, "msg") Case $WM_HSCROLL ; 276 Local $iRightScrollThumb = _GUIScrollBars_GetScrollBarXYThumbBottom($hRichEdit, $OBJID_HSCROLL) ConsoleWrite("$iRightScrollThumb = " & $iRightScrollThumb & " / " & _ "$iMaxScrollHoriz = " & $iMaxScrollHoriz & @crlf) If $iRightScrollThumb = $iMaxScrollHoriz Then _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_DISABLE_RIGHT) Else _GUIScrollBars_EnableScrollBar($hRichEdit, $SB_HORZ, $ESB_ENABLE_BOTH) EndIf Case $WM_VSCROLL ; 277 EndSwitch EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Anyway, that's a start, better than nothing mike1950r, Zedna and mikell 3 Link to comment Share on other sites More sharing options...
mike1950r Posted June 26, 2023 Author Share Posted June 26, 2023 (edited) Hi pixelsearch, thanks lot for your code. In my window I had to get the max position with $tSCROLLBARINFO.Right - 22. I have tried all other options, but this was the only one, which worked. I will have to find a formula which works on standalone editor and also on embeded editor. When scrolling to the right pressing on the arrow constantely it passes the max position. If you scroll with arrow click arrow, click arrow ... it works fine also clicking once left arrow enables correctly the diabled right arrow. Cheers mike Edited June 27, 2023 by mike1950r Link to comment Share on other sites More sharing options...
mike1950r Posted June 27, 2023 Author Share Posted June 27, 2023 Hi pixelsearch, the formula for the max position must be: $tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hRichEdit, $OBJID_HSCROLL) $iMaxScrollHoriz = $tSCROLLBARINFO.Right - $tSCROLLBARINFO.dxyLineButton - $tSCROLLBARINFO.Left This works fine standalone or embeded Cheers mike Link to comment Share on other sites More sharing options...
pixelsearch Posted June 27, 2023 Share Posted June 27, 2023 Mike, could you please run the example script found in the help file, topic GUIScrollBars_GetScrollBarInfoEx ? Then just take a pic of the displayed GUI (without any shrinking or enlargement, just its exact size) and post it here, ok ? It should allow to explain why this line didn't make it for you : $iMaxScrollHoriz = $tSCROLLBARINFO.Right - $tSCROLLBARINFO.xyThumbTop - $tSCROLLBARINFO.Left Meanwhile, I checked the results of the help file example with a reworked script (no major change, just added a tooltip while moving the mouse, also have the edit scrollbars disappear, to focus on the GUI scrollbars etc...) : * Tooltip on the left (100/500) matches what's found in $tagSCROLLBARINFO structure : Left = 100, Top = 500, which are the absolute coords of the left upper corner of the scrollbar (coords related to screen) * Tooltip on the right (500/517) matches what's found in $tagSCROLLBARINFO structure : Right = 500, Bottom = 517, which are the absolute coords of the right down corner of the scrollbar (coords related to screen) So far so good... * Tooltip on the left (117/...) corresponds (if I'm not wrong) to xyThumbTop, which is the "position of the top (for vertical scrollbar) or left (for horizontal scrollbar) of the thumb." We see the tooltip displays 117 and not 17 as in the GUI display (e.g $tagSCROLLBARINFO structure) so I guess this result of 17 is relative to the scrollbar itself (on the contrary, Left, Top, Right & Bottom were related to screen) * Tooltip on the right (419/...) corresponds (if I'm not wrong) to xyThumbBottom, which is the "position of the bottom (for vertical scrollbar) or right (for horizontal scrollbar) of the thumb." We see the tooltip displays 419 and not 319 as in the GUI display (e.g $tagSCROLLBARINFO structure) so I guess this result of 319 is relative to the scrollbar itself (on the contrary, Left, Top, Right & Bottom were related to screen) This tooltip (483/...) indicates the maximum hozizontal scrollable position, related to screen (in fact 383 if we substract the left coordinate 100 to have it related to the scrollbar) 483 = 500 - 17 , with 17 being the width of the scrollable right arrow (which is also the value of xyThumbTop as the left coord of the thumb follows immediately the scrollable left arrow So I don't understand why it didn't work for you, because you had to substract dxyLineButton instead of xyThumbTop. According to the help file (topic $tagSCROLLBARINFO), "dxyLineButton is the Height (for horizontal scrollbars ?) or width (for vertical scrollbars ?) of the thumb" If I understood it correctly, why should we calculate the maximum scrollable position, introducing in the formula a value indicating... the height of the horizontal scrollbar ? In my pics, both xyThumbTop and dxyLineButton got a value of 17 (as the scrollable arrows seem to be square). That's why I would like to see what will appear on your pic : will it show different values for xyThumbTop and dxyLineButton, with non-square scrollable arrows ? Another possibility is that msdn is mistaken (I highly doubt that) and dxyLineButton is the height (for vertical scrollbars) or width (for horizontal scrollbars) of ... the scroll arrows : this would in fact explain why you had to use dxyLineButton instead of xyThumbTop in the formula ! So I'm a bit confused now. Sorry for the wrong assumptions in this post, just waiting for some clarification Link to comment Share on other sites More sharing options...
mike1950r Posted June 27, 2023 Author Share Posted June 27, 2023 hi pixelsearch, here it is. cheers mike  Link to comment Share on other sites More sharing options...
pixelsearch Posted June 27, 2023 Share Posted June 27, 2023 Thanks, the pic confirms that you got the same value (16) for xyThumbTop and dxyLineButton Link to comment Share on other sites More sharing options...
mike1950r Posted June 27, 2023 Author Share Posted June 27, 2023 hi pixelsearch, in my program i get: $tSCROLLBARINFO.dxyLineButton = 16 $tSCROLLBARINFO.xyThumbTop = 121 I do not know, why I get this difference, but it is like this. cheers mike 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