Terenz Posted February 3, 2016 Share Posted February 3, 2016 (edited) Hi, I want to connect two edit box in both way, no matter where you write. My attempt: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GuiScrollBars.au3> $Form1 = GUICreate("Form1", 392, 329, -1, -1) $sEdit1 = GUICtrlCreateEdit("", 8, 8, 185, 150, $GUI_SS_DEFAULT_EDIT) $sEdit2 = GUICtrlCreateEdit("", 198, 6, 185, 150, $GUI_SS_DEFAULT_EDIT) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord Switch $iIDFrom Case $sEdit2 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit1, GUICtrlRead($sEdit2)) EndIf Case $sEdit1 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit2, GUICtrlRead($sEdit1) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND About text, work. Is the scrollbar the problem...i think i need GUIRegisterMsg with both WM_HSCROLL and WM_VSCROLL but i don't have find an example in this direction of what i want to do Thanks for the help Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
kylomas Posted February 3, 2016 Share Posted February 3, 2016 Terenz, Are you saying that you want them to scroll synchronously? Kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Terenz Posted February 3, 2016 Author Share Posted February 3, 2016 Yes kylomas Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
InunoTaishou Posted February 3, 2016 Share Posted February 3, 2016 (edited) I don't have an example for a regular edit box but you can use a richedit instead of a regular edit and use _GUICtrlRichEdit_ScrollLines Edited February 3, 2016 by InunoTaishou Link to comment Share on other sites More sharing options...
Terenz Posted February 3, 2016 Author Share Posted February 3, 2016 There is also for edit but i need to intercept the message first... Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
InunoTaishou Posted February 3, 2016 Share Posted February 3, 2016 I cannot find a window message to capture for the scroll bars, I came up with this (though I think it looks kind of dirty and it had weird graphical glitches if I didn't redraw the gui) expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GuiScrollBars.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Form1", 392, 329, -1, -1) $sEdit1 = GUICtrlCreateEdit("", 8, 8, 185, 150, $GUI_SS_DEFAULT_EDIT) $sEdit2 = GUICtrlCreateEdit("", 198, 6, 185, 150, $GUI_SS_DEFAULT_EDIT) _GUIScrollBars_Init(GUICtrlGetHandle($sEdit1)) _GUIScrollBars_Init(GUICtrlGetHandle($sEdit2)) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case Else Local $aInfo = GUIGetCursorInfo() If (Not @Error) Then ; Only redraw if the scroll position changed ; Not redrawing the window shows weird graphic glitches (edit box moving/expanding, scroll bars disappearing) If (UpdateScrolls($aInfo[4])) Then _WinAPI_RedrawWindow($Form1) EndIf EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord Switch $iIDFrom Case $sEdit2 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit1, GUICtrlRead($sEdit2)) UpdateScrolls($iIDFrom) EndIf Case $sEdit1 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit2, GUICtrlRead($sEdit1)) UpdateScrolls($iIDFrom) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func UpdateScrolls(Const ByRef $activeControlId) Local $scrollbarVertPosActive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($activeControlId), $SB_VERT) Local $scrollbarHorzPosActive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($activeControlId), $SB_HORZ) Local $scrollbarVertPosInactive Local $scrollbarHorzPosInactive Local $scrollsUpdated = False Switch $activeControlId Case $sEdit1 $scrollbarVertPosInactive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($sEdit2), $SB_VERT) $scrollbarHorzPosInactive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($sEdit2), $SB_HORZ) If ($scrollbarVertPosActive <> $scrollbarVertPosInactive) Then _GUIScrollBars_SetScrollInfoPos(GUICtrlGetHandle($sEdit2), $SB_VERT, $scrollbarVertPosActive) $scrollsUpdated = True EndIf If ($scrollbarHorzPosActive <> $scrollbarHorzPosInactive) Then _GUIScrollBars_SetScrollInfoPos(GUICtrlGetHandle($sEdit2), $SB_HORZ, $scrollbarHorzPosActive) $scrollsUpdated = True EndIf Case $sEdit2 $scrollbarVertPosInactive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($sEdit1), $SB_VERT) $scrollbarHorzPosInactive = _GUIScrollBars_GetScrollPos(GUICtrlGetHandle($sEdit1), $SB_HORZ) If ($scrollbarVertPosActive <> $scrollbarVertPosInactive) Then _GUIScrollBars_SetScrollInfoPos(GUICtrlGetHandle($sEdit1), $SB_VERT, $scrollbarVertPosActive) $scrollsUpdated = True EndIf If ($scrollbarHorzPosActive <> $scrollbarHorzPosInactive) Then _GUIScrollBars_SetScrollInfoPos(GUICtrlGetHandle($sEdit1), $SB_HORZ, $scrollbarHorzPosActive) $scrollsUpdated = True EndIf EndSwitch ; Return true if either of the scrolls changed Return $scrollsUpdated EndFunc I'm sure one of the gods of Autoit will come along and know exactly what window message to listen for to know how to change the scroll bars in a prettier way. Link to comment Share on other sites More sharing options...
Terenz Posted February 3, 2016 Author Share Posted February 3, 2016 (edited) Your version flash and blink also with RedrawWindow but thanks for the attempt. This is mine: expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GuiScrollBars.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Form1", 392, 329, -1, -1) $sEdit1 = GUICtrlCreateEdit("", 8, 8, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit1 = GUICtrlGetHandle(-1) $sEdit2 = GUICtrlCreateEdit("", 198, 6, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit2 = GUICtrlGetHandle(-1) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord Local $iIndex Switch $iIDFrom Case $sEdit2 Select Case $iCode = 0x300 ; $EN_CHANGE GUICtrlSetData($sEdit1, GUICtrlRead($sEdit2)) Case $iCode = 0x602 ; $EN_VSCROLL _SyncScroll($hEdit2, $hEdit1, 1) Case $iCode = 0x601 ; $EN_HSCROLL _SyncScroll($hEdit2, $hEdit1, 0) EndSelect Case $sEdit1 Select Case $iCode = 0x300 ; $EN_CHANGE GUICtrlSetData($sEdit2, GUICtrlRead($sEdit1)) Case $iCode = 0x602 ; $EN_VSCROLL _SyncScroll($hEdit1, $hEdit2, 1) Case $iCode = 0x601 ; $EN_HSCROLL _SyncScroll($hEdit1, $hEdit2, 0) EndSelect EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _SyncScroll($hFrom, $hDest, $iType) ; 0 horiziontal, 1 vertical Local $iGetInfo, $iSetInfo, $tSCROLLINFO = DllStructCreate($tagSCROLLINFO) DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO)) DllStructSetData($tSCROLLINFO, "fMask", $_SCROLLBARCONSTANTS_SIF_ALL) $iGetInfo = _GUIScrollBars_GetScrollInfo($hFrom, $iType, $tSCROLLINFO) If $iGetInfo = False Then Return SetError(1, 0, 0) DllStructSetData($tSCROLLINFO, "nPage", DllStructGetData($tSCROLLINFO, "nPage")) DllStructSetData($tSCROLLINFO, "nPos", DllStructGetData($tSCROLLINFO, "nPos")) DllStructSetData($tSCROLLINFO, "nMin", DllStructGetData($tSCROLLINFO, "nMin")) DllStructSetData($tSCROLLINFO, "nMax", DllStructGetData($tSCROLLINFO, "nMax")) DllStructSetData($tSCROLLINFO, "nTrackPos", DllStructGetData($tSCROLLINFO, "nTrackPos")) $iSetInfo = _GUIScrollBars_SetScrollInfo($hDest, $iType, $tSCROLLINFO) If $iSetInfo = -1 Then Return SetError(2, 0, 0) EndFunc ;==>_SyncScroll Know problems to solve: 1) When it gos to the end of the edit box and "start" the autoscroll, the scrollbar goes in opposite way 2) The scrollbar move when i click on arrows, when i use the mouse wheel but it don't scroll nothing, the text don't move, a missing function of _GUICreateEdit? When i move directly the thumb don't do nothing, need to add the SB_THUMBTRACK but i don't know how 3) Maybe other things but actually i don't know, my knowledge stop here. Edited February 3, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) So...waiting for someone ( where are all? ) i have search in other language and i have found this: How can I sync the scrolling of two multiline textboxes? GUIRegisterMsg with both WM_HSCROLL and WM_VSCROLL not work and i don't know why so i have try with a proc ( dunno if is the right way ) and at least capture the scrolling, what variable is 0x14? That example use SendMessage for update the scroll and is the right way to do because moving the scroll with _GUIScrollBars* don't really scroll the edit expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ScrollBarConstants.au3> #include <GuiScrollBars.au3> #include <WinAPI.au3> $Form1 = GUICreate("Form1", 392, 329, -1, -1) $sEdit1 = GUICtrlCreateEdit("", 8, 8, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit1 = GUICtrlGetHandle(-1) $sEdit2 = GUICtrlCreateEdit("", 198, 6, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit2 = GUICtrlGetHandle(-1) $hEdit1_ProcNew = DllCallbackRegister("_Edit1Proc", "ptr", "hwnd;uint;long;ptr") $hEdit1_ProcOld = _WinAPI_SetWindowLong($hEdit1, 0xFFFFFFFC, DllCallbackGetPtr($hEdit1_ProcNew)) ; $GWL_WNDPROC _WinAPI_SetWindowLong($hEdit1, 0xFFFFFFFC, DllCallbackGetPtr($hEdit1_ProcNew)) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _WinAPI_SetWindowLong($hEdit1, 0xFFFFFFFC, $hEdit1_ProcOld) DllCallbackFree($hEdit1_ProcNew) Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord Switch $iIDFrom Case $sEdit2 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit1, GUICtrlRead($sEdit2)) EndIf Case $sEdit1 If $iCode = 0x300 Then ; $EN_CHANGE GUICtrlSetData($sEdit2, GUICtrlRead($sEdit1)) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND Func _Edit1Proc($hWnd, $iMsg, $wParam, $lParam) ;~ ConsoleWrite(Hex($iMsg) & @CR) Switch $iMsg Case 0x14 ; scrolling? From consolewrite ConsoleWrite(1) ; and now SendMessage? EndSwitch Return _WinAPI_CallWindowProc($hEdit1_ProcOld, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_Edit1Proc Please MPV-Mod an help Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2016 Moderators Share Posted February 4, 2016 Terenz, This seems to work quite nicely: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> ; Create flags $fEditChanged = 0 $fScrolled = 0 $hGUI = GUICreate("Test", 500, 500) $cEdit_1 = GUICtrlCreateEdit("", 10, 10, 240, 200) $cEdit_2 = GUICtrlCreateEdit("", 260, 10, 240, 200) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; If edit change flag set If $fEditChanged Then ; Read changed edit $sData = GUICtrlRead($fEditChanged) Switch $fEditChanged Case $cEdit_1 ; Load content into other edit GUICtrlSetData($cEdit_2, $sData) Case $cEdit_2 GUICtrlSetData($cEdit_1, $sData) EndSwitch ; Now match scrolls _MatchScroll($fEditChanged) ; Clear flag $fEditChanged = 0 EndIf ; If edit scroll flag set If $fScrolled Then _MatchScroll($fScrolled) ; Clear flag $fScrolled = 0 EndIf WEnd Func _WM_COMMAND($hWHnd, $iMsg, $wParam, $lParam) ; If it was an update message from an edit $iCID = _WinAPI_LoWord($wParam) $iCode = _WinAPI_HiWord($wParam) Switch $iCode Case $EN_CHANGE Switch $iCID Case $cEdit_1, $cEdit_2 ; Set the flag with the edit CID $fEditChanged = $iCID EndSwitch Case $EN_VSCROLL Switch $iCID Case $cEdit_1, $cEdit_2 ; Set the flag with the edit CID $fScrolled = $iCID EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func _MatchScroll($iCID) ;Read first lines $iFirst_1 = _GUICtrlEdit_GetFirstVisibleLine($cEdit_1) $iFirst_2 = _GUICtrlEdit_GetFirstVisibleLine($cEdit_2) ; Match first lines Switch $iCID Case $cEdit_1 _GUICtrlEdit_LineScroll($cEdit_2, 0, $iFirst_1 - $iFirst_2) Case $cEdit_2 _GUICtrlEdit_LineScroll($cEdit_1, 0, $iFirst_2 - $iFirst_1) EndSwitch EndFunc Any use? 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...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) Thanks Melba. There is a problem using WM_COMMAND and $EN_VSCROLL, it doesn't work if you manually move the thumb of the scrollbar or you have mouse pressed on the arrow, my proc ( is written well? Did you know 0x14 stay for? ) instead yes, maybe we can mix togheter. And i need something also for hscrool or the result is this: The scrollbar goes in opposite way Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2016 Moderators Share Posted February 4, 2016 Terenz, 3 minutes ago, Terenz said: There is a problem using WM_COMMAND and $EN_VSCROLL Of course that will not support a horizontal scrollbar - the clue is in the $EN_VSCROLL. I will see what I can do about $EN_HSCROLL now. Out of curiosity, why do you want 2 edits to mirror like this anyway? 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...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) I think there is a misunderstanding I know there are two messages, one for vertical and one for horizontal but the problem is another. $EN_VSCROLL and $EN_HSCROLL don't detect when the user manually move the thumb of the scrollbar or you have mouse pressed on the Arrow BUT only when you single click on the arrow or you move the scrollbar with the mouse wheel so WM_COMMAND+EN_VSCROLL+EN_HSCROLL for detect the scrollbar i don't think is the right way to approach to this. The best way was WM_HSCROLL and WM_VSCROLL but i don't know why GUIRegisterMsg not work with that, the proc seems work for every cases ( but i'm intercept a different iMsg... ) and on stackoverflow they use SendMessage, also in this case i don't know in what way Is clear what i'm say? I need multiple editbox for comparing document, not only two but the principe is the same. Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2016 Moderators Share Posted February 4, 2016 Terenz 27 minutes ago, Terenz said: I need multiple editbox for comparing document In which case I have been wasting my time as the method I have been using will not work. I get really annoyed when people do not explain what they really want from the outset. If I find time I will look into this again later, but right now other matters are much more pressing. 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...
BrewManNH Posted February 4, 2016 Share Posted February 4, 2016 45 minutes ago, Terenz said: I need multiple editbox for comparing document, not only two but the principe is the same. Why reinvent the wheel, use WinMerge. TheSaint 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 I don't understand who cares about my reason until don't break any rules, I want to show my wife how much i'm cool with editbox, so what? Or maybe i have see it in WinMerge and i'd like to undestand how it works, i'll repeat who cares guys i really don't understand, i'd like to learn new things. Anyway... Removed WM_COMMAND, now everything is make inside the proc. I'm try to understand that SendMessage from the C# in what way work. expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> OnAutoItExitRegister("_Exit") $hGUI = GUICreate("Form1", 392, 329, -1, -1) $sEdit1 = GUICtrlCreateEdit("", 8, 8, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit1 = GUICtrlGetHandle($sEdit1) $sEdit2 = GUICtrlCreateEdit("", 198, 6, 185, 150, $GUI_SS_DEFAULT_EDIT) $hEdit2 = GUICtrlGetHandle($sEdit2) GUISetState(@SW_SHOW) $hEdit1_ProcNew = DllCallbackRegister("_Edit1Proc", "ptr", "hwnd;uint;long;ptr") $hEdit1_ProcOld = _WinAPI_SetWindowLong($hEdit1, 0xFFFFFFFC, DllCallbackGetPtr($hEdit1_ProcNew)) ; $GWL_WNDPROC While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Edit1Proc($hWnd, $iMsg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF);LoWord Local $iCode = BitShift($wParam, 16) ;HiWord Switch $hWnd Case $hEdit1 Switch $iMsg Case $WM_HSCROLL ConsoleWrite("$WM_HSCROLL" & @CR) Case $WM_VSCROLL ConsoleWrite("$WM_VSCROLL" & @CR) Case $WM_CHAR GUICtrlSetData($sEdit2, GUICtrlRead($sEdit1)) EndSwitch Switch $iCode Case 120 ConsoleWrite("MOUSE_UP" & @CR) Case -120 ConsoleWrite("MOUSE_DOWN" & @CR) EndSwitch EndSwitch Return _WinAPI_CallWindowProc($hEdit1_ProcOld, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_Edit1Proc Func _Exit() _WinAPI_SetWindowLong($hEdit1, 0xFFFFFFFC, $hEdit1_ProcOld) DllCallbackFree($hEdit1_ProcNew) GUIDelete($hGUI) EndFunc ;==>_Exit Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2016 Moderators Share Posted February 4, 2016 Terenz, I only asked about why you wanted to do it because I was concerned that the method I was using was not going to be valid for the real-world case you were looking to achieve - no more than that. I then got annoyed because, as I suspected, my efforts were completely worthless and I could well have spent the time working on something else more useful. 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...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) When it will finished, if it will be finished, will be useful for people what to understand how subclassing-proc-message work in a autoit control, not only for edit ( P.S. If you search online you will found a plenty thread equal to this for different programming language, this not the only on the web, for listbox, richtextboxes, listview and so on ) Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2016 Moderators Share Posted February 4, 2016 Terenz, I am not arguing against the suggestion that such a script as you envisage could well be useful - my gripe is with the fact that you did not clearly explain the required endstate from the beginning: On 03/02/2016 at 4:12 PM, Terenz said: I want to connect two edit box in both way, no matter where you write is not at all the same as: 2 hours ago, Terenz said: I need multiple editbox for comparing document But I am now out of here and already heavily engaged on another problem. 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...
InunoTaishou Posted February 4, 2016 Share Posted February 4, 2016 Here's some full code in VB that does exactly what you want (using RichEdit but it's the same stuff) http://www.codeproject.com/Articles/7830/Scrolling-Around-with-the-RichTextBox-Control A lot more in depth than the stackoverflow post you found. Link to comment Share on other sites More sharing options...
Terenz Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) Yeah i know there are many example but all in other languages...i don't know VB or C# so i'm trying to keep up with the turning of the wheel but i don't think i'll accomplish this time. An image just for fun of a .NET project Edited February 4, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength 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