AndreyS Posted December 26, 2013 Author Posted December 26, 2013 (edited) Excellent work function! Thank you PhoenixXL! Do not expect so much help that much to get a full UDF. Almost completely replaced my ListBox on EditList. However, there is still a couple of things that I do not know how to solve. For example, I need identify that there was a click on EditList? For example: expandcollapse popup#include <EditList.au3> Opt("GUIOnEventMode", 1) $hMain = GUICreate("Test", 500, 300) Global $hRichEdit_ = _Edit_List_Create(10, 10, 300, 200, $hMain) $But1 = GUICtrlCreateButton("1",330, 100, 40, 40) GUICtrlSetOnEvent(-1,"OnClick_Handler") $But2 = GUICtrlCreateButton("2",380, 100, 40, 40) GUICtrlSetOnEvent(-1,"OnClick_Handler") _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling."&@CRLF) _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)"&@CRLF) _Edit_List_InsertItem("3. COM support"&@CRLF) _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs."&@CRLF) _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling."&@CRLF) _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)"&@CRLF) _Edit_List_InsertItem("3. COM support"&@CRLF) _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs."&@CRLF) _Edit_List_SetOnEvent("OnClick_Handler") GUISetState() _SendMessage($hRichEdit_, $WM_SETFOCUS) ;required for initial hiding of the caret While GUIGetMsg() <> -3 Sleep(10) WEnd Func OnClick_Handler() If @GUI_CtrlId=$But1 Then ConsoleWrite("Press Button 1" & @CRLF) ElseIf @GUI_CtrlId=$hRichEdit_ Then ConsoleWrite("Press EditList" & @CRLF) ElseIf @GUI_CtrlId=$But2 Then ConsoleWrite("Press Button 2" & @CRLF) EndIf EndFunc Prompt if there are options, how to recognize a click on EL? P.S. Already using beta like until all without problems except for an error in the file: APIMiscConstants.au3 which apparently refers to the file Resources.au3. Edited December 26, 2013 by AndreyS
PhoenixXL Posted December 27, 2013 Posted December 27, 2013 The macros are manipulated by autoit under the hood, I have no option to manipulate them( as far as I know). Just use a different function and that is the identity that the editlist is pressed Example expandcollapse popup#include <EditList.au3> Opt("GUIOnEventMode", 1) $hMain = GUICreate("Test", 500, 300) Global $hRichEdit_ = _Edit_List_Create(10, 10, 300, 200, $hMain) $But1 = GUICtrlCreateButton("1", 330, 100, 40, 40) GUICtrlSetOnEvent(-1, "OnClick_Handler") $But2 = GUICtrlCreateButton("2", 380, 100, 40, 40) GUICtrlSetOnEvent(-1, "OnClick_Handler") _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling." & @CRLF) _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)" & @CRLF) _Edit_List_InsertItem("3. COM support" & @CRLF) _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs." & @CRLF) _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling." & @CRLF) _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)" & @CRLF) _Edit_List_InsertItem("3. COM support" & @CRLF) _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs." & @CRLF) _Edit_List_SetOnEvent("OnClick_RichEditHandler") GUISetState() _SendMessage($hRichEdit_, $WM_SETFOCUS) ;required for initial hiding of the caret While GUIGetMsg() <> -3 Sleep(10) WEnd Func OnClick_Handler() If @GUI_CtrlId = $But1 Then ConsoleWrite("Press Button 1" & @CRLF) ElseIf @GUI_CtrlId = $But2 Then ConsoleWrite("Press Button 2" & @CRLF) EndIf EndFunc ;==>OnClick_Handler Func OnClick_RichEditHandler() ConsoleWrite("RichEdit Pressed") EndFunc Regards My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted December 28, 2013 Author Posted December 28, 2013 That's a pity! I have one big function for processing. Difficult otherwise. But thanks anyway. Very grateful, PhoenixXL, for your continued support! And nothing you can do to when the focus to another control on the selection does not disappear?
PhoenixXL Posted December 31, 2013 Posted December 31, 2013 Done!! AndreyS 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted December 31, 2013 Author Posted December 31, 2013 Oh! Thank you! I see what was missing. I myself would not have guessed. And you can somehow make it so that when scrolling up showing the entire item, not just its last line? PS Happy New Year and Merry Christmas to you!
PhoenixXL Posted December 31, 2013 Posted December 31, 2013 Done..! Happy New Year and Merry Christmas AndreyS 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted December 31, 2013 Author Posted December 31, 2013 Lightning fast decision! Thank you, PhoenixXL, for that, despite the holidays, you're here and helped me!
AndreyS Posted January 8, 2014 Author Posted January 8, 2014 (edited) Continue to improve on the idea. PhoenixXL, is it possible to change the mouse cursor when it is placed over the EL? Tried to apply the standard function(GUICtrlSetCursor) changes the cursor, but it does not work. And is there any hope that it will be possible to use two controls EL? It's too good and he wants to use in multiple positions! Edited January 8, 2014 by AndreyS
PhoenixXL Posted January 9, 2014 Posted January 9, 2014 (edited) Cursor part is done. To encorporate multiple edit lists global variables just should be converted to arrays so that data of multiple items could be added and retreived, converting the whole script back to using arrays would consume much time. I leave it to you as this isn't that hard. Regards Edited January 9, 2014 by PhoenixXL AndreyS 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted January 9, 2014 Author Posted January 9, 2014 Thank you PhoenixXL! Yes, what you're saying?! If I did not think to change the cursor, then something more accurately not master. May once more to grow to the desired level. Thanks for your help!
AndreyS Posted January 9, 2014 Author Posted January 9, 2014 I do not understand why, but I started to be an error in the file Resources.au3 after upgrading to a new release Autoit. Yes, I use the function of this file and the bug seems to reconnect this file in the file EditList.au3. How to solve this problem, PhoenixXL? Error: "D:\Program Files\AutoIt3\Include\Resources.au3"(9,28) : error: $RT_CURSOR previously declared as a 'Const'. Global Const $RT_CURSOR = 1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "D:\Program Files\AutoIt3\Include\Resources.au3"(10,28) : error: $RT_BITMAP previously declared as a 'Const'. Global Const $RT_BITMAP = 2 ...
PhoenixXL Posted January 10, 2014 Posted January 10, 2014 can you show me your includes as i havent faced this problem My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted January 10, 2014 Author Posted January 10, 2014 Yes, of course that's my includes: #include-once #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <Date.au3> #include <GuiEdit.au3> #include <StaticConstants.au3> #include <GDIPlus.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GuiRichEdit.au3> #include <Sound.au3> #include <INet.au3> #include <DateTimeConstants.au3> #include <String.au3> #include <ListboxConstants.au3> #include <ID3_v3.4.au3> #include <StringSize.au3> #include <VLC.au3> #include <SliderConstants.au3> #include <GuiListBox.au3> #include <MouseOnEvent.au3> #include <GUIMenu.au3> #include <EditList.au3> #include <Resources.au3> The problem in the latter two files. They are duplicate include files and therefore is re-declare constants. But why this error started to arise as soon as I changed the release Autoit and how to solve it if I need to also use functions Resurces.au3?
PhoenixXL Posted January 11, 2014 Posted January 11, 2014 (edited) Then its a problem in #include <Resources.au3>. As it is not updated with the new release. comment out the declaration lines in the UDF that give you the error of redeclaration. Edited January 11, 2014 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted January 11, 2014 Author Posted January 11, 2014 Then tell me which file to comment out the best constants? D: \ Program Files \ AutoIt3 \ Include \ APIResConstants.au3 (1 hit) Line 19: Global Const $ RT_CURSOR = 1 ... or D: \ Program Files \ AutoIt3 \ Include \ Resources.au3 (1 hit) Line 9: Global Const $ RT_CURSOR = 1 ...
PhoenixXL Posted January 12, 2014 Posted January 12, 2014 (edited) the one in resources.au3 Edited January 12, 2014 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted January 12, 2014 Author Posted January 12, 2014 Thanks, and did! PhoenixXL, has immediate tasks / problems . 1. When filling EL items present in it for some reason some invisible last item on which you can even carry a click. How to get rid of this false item? So that when you click anywhere on a particular item stood out . 2 . After filling EL many items I need to make the transition to the very first item. I do it like this: _GUICtrlRichEdit_SetScrollPos($EditList, 1, 1) But the trouble is that when the text cursor appears at the end of the items. What he finds there is an invisible last position, I think it is related to the first problem somehow. I would like to have a special function to work correctly in EditList.au3 Need your help again...
PhoenixXL Posted January 13, 2014 Posted January 13, 2014 (edited) Its maybe you are using @CRLF in the text, so that, it is even a part of the item. To get rid of it set the Appendstring to "@CRLF & @CRLF" in _Edit_List_Create. Further I could be more helpful if you can show me through an example. Regards Edited January 13, 2014 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
AndreyS Posted January 13, 2014 Author Posted January 13, 2014 And it does not matter at all. Okey, here is the same example that demonstrates two problems at once. 1. Scroll down and there will be a cursor that should not be there. 2. Clicking can be done at the end all the items, which should highlight the last item. But this is not happening. There is even a kind of incomprehensible last line empty. #include <EditList.au3> $hMain = GUICreate("Test", 500, 300) Global $hRichEdit_ = _Edit_List_Create(10, 10, 300, 200, $hMain) _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling.") _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)") _Edit_List_InsertItem("3. COM support") _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs.") _Edit_List_InsertItem("1. The usual high-level elements for functions, loops and expression-handling.") _Edit_List_InsertItem("2. A staggering amount of string handling functions and a Perl Compatible Regular Expression Engine(PCRE)") _Edit_List_InsertItem("3. COM support") _Edit_List_InsertItem("4. Call Win32 and Third-Party DLL APIs.") _Edit_List_SetOnEvent("OnClick_Handler") _GUICtrlRichEdit_SetScrollPos($hRichEdit_, 0, 0) _Edit_List_SetOnEvent("OnClick_Handler") GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEnd Func OnClick_Handler() MsgBox(0,_GUICtrlRichEdit_IsTextSelected ( $hRichEdit_ ),_Edit_List_GetItemText()) EndFunc
AndreyS Posted February 12, 2014 Author Posted February 12, 2014 Hello PhoenixXL! Use your UDF. It is almost perfect! I'd love to to have another opportunity to use several EL. Trying to do it, but the problem occurs in function _NewWnd_Proc_ (): "D:Program FilesAutoIt3IncludeEditList_.au3"(162,57) : warning: $h_ControlHwnd: possibly used before declaration. _Edit_List_SetSel($h_ControlHwnd, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "D:Program FilesAutoIt3IncludeEditList_.au3"(162,57) : error: $h_ControlHwnd: undeclared global variable. _Edit_List_SetSel($h_ControlHwnd, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Tell me, please, how can I fix this error? expandcollapse popup#include-once #include <Array.au3> #include <WinAPISys.au3> #include <WinAPIRes.au3> #include <APISysConstants.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <Constants.au3> ; = = = = = = . . . . Private UDF Global Variables =========================================================== Global $aItems[1] ;stores Item indexes Global $sAppend ;stores Item delimited Global $__hCur ;stores the handle to the cursor ;~ Global $h_ControlHwnd ;stores the handle of the control. Global $p_Original_WindowProc ;stores the original window procedure(WndProc) of the edit control. Global $h_NewWndProc = DllCallbackRegister("_NewWnd_Proc_", "int", "hwnd;uint;wparam;lparam") ;hanlde to the new WndProc Global $p_NewWndProc = DllCallbackGetPtr($h_NewWndProc) ;pointer to the new WndProc. Global $s_OnEventFunc ;string storing the name of the func to call upon click. Func _Edit_List_Create($iX, $iY, $iWidth, $iHeight, $hWin, $sAppendString = -1) $h_ControlHwnd = _GUICtrlRichEdit_Create($hWin, "", $iX, $iY, $iWidth, $iHeight, BitOR($WS_TABSTOP, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_NOHIDESEL)) ;~ OnAutoItExitRegister("Destroy") $p_Original_WindowProc = _Subclass_($h_ControlHwnd, $p_NewWndProc) _GUICtrlRichEdit_SetText($h_ControlHwnd, "") If $sAppendString = -1 Then $sAppendString = @LF $sAppend = $sAppendString $aItems[0] = -StringLen($sAppend) Return $h_ControlHwnd ; EndFunc ;==>_Edit_List_Create Func _Edit_List_InsertItem($h_ControlHwnd, $s_Text, $iIndex = -1) Local $sEdit_Text = _GUICtrlRichEdit_GetText($h_ControlHwnd) Local $iMaxLen = StringLen($sEdit_Text) If IsInt($iIndex) = 0 Then Return SetError(2, 0, 0) ;bad $iIndex $s_Text = StringRegExpReplace($s_Text, "\v+", @LF) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) If $iIndex >= 1 Then Local $iUbound = UBound($aItems) If $iIndex > $iUbound Then Return SetError(3, 0, 0) ;bad $iIndex _GUICtrlRichEdit_GotoCharPos($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend)) _GUICtrlRichEdit_InsertText($h_ControlHwnd, $s_Text & $sAppend) Local $Change = StringLen($s_Text & $sAppend) _ArrayInsert($aItems, $iIndex - 1, $aItems[$iIndex - 1]) ;reset the array For $i = $iIndex To $iUbound $aItems[$i] += $Change Next ElseIf $iIndex = -1 Then _ArrayAdd($aItems, StringLen($sEdit_Text & $s_Text)) _GUICtrlRichEdit_AppendText($h_ControlHwnd, $s_Text & $sAppend) Else Return SetError(1, 0, 0) ;$iIndex parameter is wrong. EndIf Return 1 EndFunc ;==>_Edit_List_InsertItem Func _Edit_List_GetItemText($h_ControlHwnd, $iIndex = -1) ;by default gets the selected items text If $iIndex = -1 Then Return _GUICtrlRichEdit_GetSelText($h_ControlHwnd) If $iIndex <= 0 Or IsInt($iIndex) = 0 Then Return SetError(1, 0, 0) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) Return _GUICtrlRichEdit_GetTextInRange($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex]) EndFunc ;==>_Edit_List_GetItemText Func _Edit_List_GetSelItemIndex($h_ControlHwnd) Local $iLowerIndex = _GUICtrlRichEdit_GetSel($h_ControlHwnd) If @error Then Return SetError(1, @error, 0) $iLowerIndex = $iLowerIndex[0] For $i = 1 To UBound($aItems) - 1 Switch $iLowerIndex Case $aItems[$i - 1] + StringLen($sAppend) To $aItems[$i] Return $i EndSwitch Next Return SetError(2, 0, 0) EndFunc ;==>_Edit_List_GetSelItemIndex ;The Following function was works using the functions of the already present library. ;Therefore it would work with both OnEvent as well as MsgLoop methods. ;PS: The OnEvent macros won't work like @GUI_CTRLID, etc. ;Use _Edit_List_SetOnClick("") to deregister an already registered function. ;The function should not have any parameter. Func _Edit_List_SetOnEvent($h_ControlHwnd, $s_FuncName) $s_OnEventFunc = $s_FuncName EndFunc ;==>_Edit_List_SetOnEvent Func _Edit_List_SetCursor($h_ControlHwnd, $hCursor) $__hCur = $hCursor;_WinAPI_CopyCursor() EndFunc Func _Edit_List_SetSel($h_ControlHwnd, $iIndex, $iReverse = False) ;key: the index of the array is the length of the item, ;use the index of the previous item to get the initial position of the required item If IsInt($iIndex) = 0 Or $iIndex < 1 Or $iIndex >= UBound($aItems) Then Return SetError(1, 0, 0) Local $iAnchor = $aItems[$iIndex - 1] + StringLen($sAppend) Local $iActive = $aItems[$iIndex] If $iReverse Then _ArraySwap($iActive, $iAnchor) Return _GUICtrlRichEdit_SetSel($h_ControlHwnd, $iAnchor, $iActive) EndFunc ;==>_Edit_List_SetSel Func _Edit_List_RemoveItem($h_ControlHwnd, $iIndex) If $iIndex >= UBound($aItems) Then Return SetError(3, 0, 0) _GUICtrlRichEdit_SetSel($h_ControlHwnd, $aItems[$iIndex - 1] + StringLen($sAppend), $aItems[$iIndex] + 1) _GUICtrlRichEdit_ReplaceText($h_ControlHwnd, "", False) Local $Change = StringLen(_Edit_List_GetItemText($iIndex) & $sAppend) _ArrayDelete($aItems, $iIndex) ;reset the array For $i = $iIndex To UBound($aItems) - 1 $aItems[$i] -= $Change Next _SendMessage($h_ControlHwnd, $WM_SETFOCUS) EndFunc ;==>_Edit_List_RemoveItem Func _NewWnd_Proc_($hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK $iX = _WinAPI_LoWord($lParam) $iY = _WinAPI_HiWord($lParam) $iChar = _GUICtrlRichEdit_GetCharPosFromXY($hWnd, $iX, $iY); For $n = 1 To UBound($aItems) - 1 Switch $iChar Case $aItems[$n - 1] + StringLen($sAppend) To $aItems[$n] _Edit_List_SetSel($h_ControlHwnd,$n, 1) _GUICtrlRichEdit_ScrollToCaret($hWnd) EndSwitch Next Call($s_OnEventFunc) Return 0; Case $WM_SETFOCUS, $WM_KILLFOCUS Local $iRet = _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam) Switch $iMsg Case $WM_KILLFOCUS DllCall("user32.dll", "int", "ShowCaret", "hwnd", $hWnd) Case $WM_SETFOCUS DllCall("user32.dll", "int", "HideCaret", "hwnd", $hWnd) EndSwitch Return $iRet Case $WM_RBUTTONDOWN, $WM_CHAR Return 0 Case $WM_SETCURSOR If $__hCur <> 0 And _WinAPI_LoWord($lParam) = 1 Then Return _WinAPI_SetCursor($__hCur) ;lparam = hittest = 1 = client area Case $WM_KEYDOWN Local Const $VK_UP_ = 0x26 Local Const $VK_DOWN_ = 0x28 Local Const $VK_ENTER_ = 0x0D Switch $wParam Case $VK_UP_, $VK_DOWN_ _Edit_List_SetSel($h_ControlHwnd,_Edit_List_GetSelItemIndex($h_ControlHwnd) + $wParam - 0x27, $wParam - 0x28) _GUICtrlRichEdit_ScrollToCaret($hWnd) Case $VK_ENTER_ Call($s_OnEventFunc) EndSwitch Return 0 EndSwitch ;go with the original processing. Return _WinAPI_CallWindowProc($p_Original_WindowProc, $hWnd, $iMsg, $wParam, $lParam) EndFunc ;==>_NewWnd_Proc_ Func _Subclass_($hWnd, $pNew_WndProc) ;substitute the WndProc of the control. Return _WinAPI_SetWindowLong ($hWnd, $GWL_WNDPROC, $pNew_WndProc) EndFunc ;==>_Subclass_ Func Destroy($h_ControlHwnd) _Subclass_($h_ControlHwnd, $p_Original_WindowProc) _GUICtrlRichEdit_Destroy($h_ControlHwnd) _WinAPI_DestroyCursor($__hCur) EndFunc ;==>Destroy Func _Edit_List_Clear($h_ControlHwnd) ReDim $aItems[1] Local $iRet = _GUICtrlRichEdit_SetText($h_ControlHwnd, "") _SendMessage($h_ControlHwnd, $WM_SETFOCUS) Return $iRet EndFunc ;==>_Edit_List_Clear
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