guti Posted April 18, 2017 Share Posted April 18, 2017 Whether it is possible to define, in principle, lines of "visible" part of the text in an element "[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]" ? (Line 37 on the image. How to determinate it?) If yes, how to set 'topindex' of the element "Scintilla"' with use of Autoit.? I didn't find anything better, than API Scintilla functions. But how to use them by means of the Autoit? Excuse for my bad English. Link to comment Share on other sites More sharing options...
mikell Posted April 18, 2017 Share Posted April 18, 2017 Strangely this works for me #include <GuiRichEdit.au3> $c = ControlGetHandle("[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]") Msgbox(0,"", _GUICtrlRichEdit_GetNumberOfFirstVisibleLine ( $c)) but with no time enough to test further more... guti 1 Link to comment Share on other sites More sharing options...
guti Posted April 20, 2017 Author Share Posted April 20, 2017 Many thanks, mikell. It works. _GUICtrlRichEdit_GetNumberOfFirstVisibleLine() But it is necessary before it to expand all follds, which are before the first visible line . ("Toggle all folds" in the View menu) If before the visible line folds were collapsed, the result is not correct. How to calculate the number of lines in the collapsed folds, which are before the first visible line? Naturally using Autoit. I think, it is the following theme for a forum. Thanks, for spent you time. Link to comment Share on other sites More sharing options...
mikell Posted April 20, 2017 Share Posted April 20, 2017 (edited) Well with a little more time I found this : you don't need to expand folders but go back to the Scintilla Api features and dig inside And this one was not so easy to find $Sci = ControlGetHandle("[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]") Global Const $SCI_GETFIRSTVISIBLELINE = 2152 Global Const $SCI_DOCLINEFROMVISIBLE = 2221 $display_visible_line1 = _Scite_SendMessage($Sci, $SCI_GETFIRSTVISIBLELINE, 0, 0) + 1 $document_visible_line1 = _Scite_SendMessage($Sci, $SCI_DOCLINEFROMVISIBLE, $display_visible_line1, 0) Msgbox(0,"", $document_visible_line1) Func _Scite_SendMessage($hwnd, $msg, $wparam, $lparam) Local $ret $ret = DllCall("user32.dll", "long", "SendMessageA", "long", $hwnd, "int", $msg, "int", $wparam, "int", $lparam) If @error Then return SetError(1, 0, 0) Return $ret[0] EndFunc ;==>_Scite_SendMessage Edited April 20, 2017 by mikell Link to comment Share on other sites More sharing options...
guti Posted April 21, 2017 Author Share Posted April 21, 2017 (edited) Many thanks, mikell. Your example led me to "Scintilla.h". This huge field for researches. Unfortunately there are no comments for many constants there. So far I will try to understand in what a difference by a call of your function $msg = $SCI_GETFIRSTVISIBLELINE ; (= 2152) $display_visible_line1 = _Scite_SendMessage($Sci, $SCI_GETFIRSTVISIBLELINE, 0, 0) + 1 Func _Scite_SendMessage($hwnd, $msg, $wparam, $lparam) $ret = DllCall("user32.dll", "long", "SendMessageA", "long", $hwnd, "int", $msg, "int", $wparam, "int", $lparam) EndFunc and such function: $msg = $EM_GETFIRSTVISIBLELINE ; (= 0xCE) (from file "EditConstants.au3) $s = _mySendMessage($Sci, $EM_GETFIRSTVISIBLELINE) + 1 Func _mySendMessage($hwnd, $iMsg, $wparam, $lparam) Local $aResult = DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hwnd, "uint", $iMsg, "wparam", $wparam, "lparam", $lparam) EndFunc ;==>_mySendMessage Perhaps: Digital - Hex, "long" - "lresult". Once again thanks that found time Edited April 21, 2017 by guti Link to comment Share on other sites More sharing options...
mikell Posted April 21, 2017 Share Posted April 21, 2017 As you could notice the Scintilla control formerly was a richedit control, reason why some Edit and RichEdit funcs still work But the clean way is to use the proper API and the Scintilla.h constants - btw it's very easy to make an Autoit include from it About the DllCall syntax yours is the good one, I was in a hurry SendMessageA = force ANSI while W = unicode Happy search Link to comment Share on other sites More sharing options...
guti Posted April 21, 2017 Author Share Posted April 21, 2017 The question is closed. Thanks for the help. 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