wraithdu Posted December 12, 2008 Share Posted December 12, 2008 Yeah, editing a post with more than one set of AUTOIT tags causes corruption for some reason. Anyway, the reason you can't use $Input1 is because the UDF's return a window handle, not a control ID. Link to comment Share on other sites More sharing options...
ProgAndy Posted December 12, 2008 Author Share Posted December 12, 2008 huh, strange, not even controlhide works for me =(, am I missing something? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> $Form1 = GUICreate("Form1", 448, 81, 193, 125) $Input1 = _GUICtrlRichEdit_CreateInput($Form1, 8, 8, 385, 21, BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL), $WS_EX_CLIENTEDGE) $button_show = GUICtrlCreateButton("SHOW", 8, 35) $button_hide = GUICtrlCreateButton("HIDE", 200, 35) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button_show ;~ WinSetState($Input1, "", @SW_SHOW) ControlShow($Input1, "", "") Case $button_hide ;~ WinSetState($Input1, "", @SW_HIDE) ControlHide($Input1, "", "") EndSwitch WEndfound the problem... CreateWindowEx returned the window handle as long, not hWnd, and WinSetState / Controlsetstate don't recognize it as Hwnd. Use ControlShow(hWnd($Input1), "", "") until i update the UDF. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
karliky Posted December 12, 2008 Share Posted December 12, 2008 WoW Thank you! Link to comment Share on other sites More sharing options...
Andrew Peacock Posted December 30, 2008 Share Posted December 30, 2008 Great job so far. Can you help on something? I'm trying to copy text from one rich text control to another. I'm piecing together the file-related functions, and got the following: Local $send = _GUICtrlRichEdit_StreamOut($txtSource, $SF_RTFNOOBJS, $VariableStreamStruct) Local $send = _GUICtrlRichEdit_StreamIn($txtDestination, $SF_RTFNOOBJS, $VariableStreamStruct) where $txtSource and $txtDestination are the two rich text controls. But nothing seem to be happening. What I actually need to do is get the text from the first control, trim it to a defined length, and then insert into the second one. Any advice on this would be appreciated! Regards, Andy Link to comment Share on other sites More sharing options...
ProgAndy Posted December 30, 2008 Author Share Posted December 30, 2008 fist, you have to get the RTF in a variable with _StremOut. Then you can insert it into the second one with StreamIn Don't forget to use 2 functions to stream. One to append to the variable, the other to read an remove from the varibale. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Andrew Peacock Posted December 30, 2008 Share Posted December 30, 2008 fist, you have to get the RTF in a variable with _StremOut. Then you can insert it into the second one with StreamIn Don't forget to use 2 functions to stream. One to append to the variable, the other to read an remove from the varibale. Ah, that gave me the clue I needed (which I should have seen from looking at the RTF, so thanks for the gentle reminder) The solution is (in case anyone else wants it): Global $EDITSTREAM_RTFVariable = "" Local $send = _GUICtrlRichEdit_StreamOut($txtSource, $SF_RTFNOOBJS, $VariableStreamStruct) _GUICtrlRichEdit_SetText($txtDestination, "") _GUICtrlRichEdit_SetText($txtDestination, $EDITSTREAM_RTFVariable) Link to comment Share on other sites More sharing options...
Andrew Peacock Posted December 30, 2008 Share Posted December 30, 2008 OK, next question if someone can help. I'm trying to let the user select a point in the source text box, and everything before that point is copied to the destination text box. I can get the point of selection via $newPoint = _GUICtrlRichEdit_GetSel ( $txtSource) $size = $newPoint[1] So no problem there. Is there any way to get all the text - including formatting - before that point? Thanks for any help in advance. Andy Link to comment Share on other sites More sharing options...
ProgAndy Posted December 30, 2008 Author Share Posted December 30, 2008 I don't know, how you could do this. Possibly use setsel and clipboard ? *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
c.haslam Posted December 31, 2008 Share Posted December 31, 2008 What is the difference between _GUICtrlRichEdit_Create() and _GUICtrlRichEdit_CreateInput? ...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
ProgAndy Posted December 31, 2008 Author Share Posted December 31, 2008 _GUICtrlRichEdit_Create creates a mutliline control, _GUICtrlRichEdit_CreateInput creates it single lined . (Or at least it should do it) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Zedna Posted December 31, 2008 Share Posted December 31, 2008 (edited) _GUICtrlRichEdit_Create creates a mutliline control, _GUICtrlRichEdit_CreateInput creates it single lined . (Or at least it should do it)It's not exact.Yiou can make input multiline too - by using ES_MULTILINE style.Main differrence is that in RichEdit you can have texts with differrent colors/fonts. Edited December 31, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ProgAndy Posted December 31, 2008 Author Share Posted December 31, 2008 I know that you can use ES_MUTLILINE in _GUICtrlRichEdit_CreateInput, too. My intention was to have same functions as for normal edits. (GUICtrlCreateInput creates single line Edit, GUICtrlCreateEdit creates multiline Edit) Between _GUICtrlRichEdit_Create and _GUICtrlRichEdit_CreateInput there is no other difference than the ES_MUTLILINE style. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Andrew Peacock Posted December 31, 2008 Share Posted December 31, 2008 I don't know, how you could do this. Possibly use setsel and clipboard ?Fantastic - it worked.My bad that I never thought of that - much appreciated.Andy Link to comment Share on other sites More sharing options...
c.haslam Posted December 31, 2008 Share Posted December 31, 2008 (edited) I see that _GUICtrlRichEdit_SetNumbering() can set a paragraph to bulleted, but how can one determine programmatically whether a paragraph is bulleted?In ProgAndy's example, I clicked on the Msg RTF button, then clicked OK in the MsgBox, but focus did not return to the Rich Edit control. How can I get the focus to return to the Rich Edit control?...chris Edited January 1, 2009 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
ProgAndy Posted January 1, 2009 Author Share Posted January 1, 2009 (edited) 1) This function is not from me, but i think, it will work this way: ; by Prog@ndy Func _GUICtrlRichEdit_GetNumbering($hWnd, ByRef $iChar , ByRef $iFormat , ByRef $iStart , ByRef $iTab ) Local $tparaformat = DllStructCreate($tagPARAFORMAT2), $dwMask = 0 DllStructSetData($tparaformat, 1, DllStructGetSize($tparaformat)) _SendMessage($hWnd, $EM_SETPARAFORMAT, 0, DllStructGetPtr($tparaformat)) $dwMask = DLLStructGetData($tparaformat, 2) If Not (BitAnd($dwMask, $PFM_NUMBERING) Or _ BitAND($dwMask, $PFM_NUMBERINGSTART) Or _ BitAND($dwMask, $PFM_NUMBERINGSTART) or _ BitAND($dwMask, $PFM_NUMBERINGSTYLE) Or _ BitAnd($dwMask, $PFM_NUMBERINGTAB) )Then Return SetError(1, 0, 0) $iChar = DllStructGetData($tparaformat, 3) $iStart = DllStructGetData($tparaformat, 19) $iFormat = DllStructGetData($tparaformat, 20) $iTab = DllStructGetData($tparaformat, 21) Return BitAnd($dwMask,BitOr($PFM_NUMBERING, $PFM_NUMBERINGSTART, $PFM_NUMBERINGSTART, $PFM_NUMBERINGSTYLE, $PFM_NUMBERINGTAB)) EndFunc ;==>_GUICtrlRichEdit_SetNumbering 2) use ControlFocus($RichEdit,"","") if you click a button, the focus changes and stays on the button. You have to focus another control manually, if the button should loose it's focus after the click. Edited January 1, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
c.haslam Posted January 1, 2009 Share Posted January 1, 2009 (edited) I make 2 suggestions with regard to the code that you offer:I think $EM_SETPARAFORMAT should be $EM_GETPARAFORMATA paragraph having no numbering should not be seen as an errorI propose the following code: Func _GUICtrlRichEdit_GetNumbering($hWnd, ByRef $iChar , ByRef $iFormat , ByRef $iStart , ByRef $iTab) Local $tparaformat = DllStructCreate($tagPARAFORMAT2),$dwMask=0 DllStructGetData($tparaformat, 1, DllStructGetSize($tparaformat)) _SendMessage($hWnd, $EM_GETPARAFORMAT, 0, DllStructGetPtr($tparaformat)) If @error Then Return SetError(-1,-1,0) $iChar = DllStructGetData($tparaformat, 3) $iStart = DllStructGetData($tparaformat, 19) $iFormat = DllStructGetData($tparaformat, 20) $iTab = DllStructGetData($tparaformat, 21) Return 1 ;==>_GUICtrlRichEdit_GetNumbering EndFunc But this code sets $iChar to 0 even when the text cursor is in a paragraph that has just been bulleted. 2. Thank you for ControlFocus($RichEdit,"",""). This usage of ControlFocus() seems to be missing from the help file, i.e. that title can be a handle is not mentioned in the help for ControlFocus (although it is for WinActivate and others). How can I help to fix lacks in the documentation? ...chris Edited January 1, 2009 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
ProgAndy Posted January 1, 2009 Author Share Posted January 1, 2009 Oops, right, this should be EM_GETPARAFORMAT.But I don't know why this doesn't work. Maybe you will find out the mistake.http://msdn.microsoft.com/en-us/library/bb774182(VS.85).aspxPossibly, you have to set dwMak before the call? *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
c.haslam Posted January 1, 2009 Share Posted January 1, 2009 (edited) The following code works for bullets: expandcollapse popup;=================================================================================================== = ; Function Name: _GUICtrlRichEdit_GetNumbering ; Description: Gets paragraph numbering and numbering type ; Parameters : $hWnd - Handle to the control ; $iChar - Characters used for numbering: ; 0 No numbering ; 1 or $PFN_BULLET Inserts a bullet ; 2 Arabic numbres (1,2,3 .) ; 3 Lowercase tetters ; 4 Uppercase letters ; 5 Lowercase roman numerals (i,ii,iii...) ; 6 Uppercase roman numerals (I, II, .) ; 7 Uses a sequence of characters beginning with ; +the Unicode character specified by ; +the wNumberingStart member ; $iFormat - Numbering style used with numbered paragraphs ; 0 Follows the number with a right parenthesis. ; 0x100 Encloses the number in parentheses. ; 0x200 Follows the number with a period. ; 0x300 Displays only the number. ; 0x400 Continues a numbered list without ; +applying the next number or bullet. ; 0x8000 Starts a new number with wNumberingStart. ; $iStart - Starting number or Unicode value used for numbered paragraphs. ; $iTab - Minimum space between a paragraph number and the paragraph text, in twips. ; Return value: 1 for success, 0 for failure, and sets @error to 1 ; Author : chris haslam c dot haslam at ieee dot org ; Notes : ;=================================================================================================== = Func _GUICtrlRichEdit_GetNumbering($hWnd, ByRef $iChar , ByRef $iFormat , ByRef $iStart , ByRef $iTab) Local $tparaformat = DllStructCreate($tagPARAFORMAT),$dwMask=0 DllStructSetData($tparaformat, 1, DllStructGetSize($tparaformat)) Local $lResult = _SendMessage($hWnd, $EM_GETPARAFORMAT, 0, DllStructGetPtr($tparaformat)) If @error Then Return SetError(1,-1,0) $iChar = DllStructGetData($tparaformat, 3) $iStart = DllStructGetData($tparaformat, 19) $iFormat = DllStructGetData($tparaformat, 20) $iTab = DllStructGetData($tparaformat, 21) Return 1 ;==>_GUICtrlRichEdit_GetNumbering EndFunc You are welcome to add it to GuiRichEdit.au3. ...chris Edited January 1, 2009 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
c.haslam Posted January 2, 2009 Share Posted January 2, 2009 (edited) _GUICtrlRichEdit_GetTextEx() seems to return the whole text, less the last character (or CRLF). Perhaps Local $buffLen = _GUICtrlRichEdit_GetTextLength($h_RichEdit) + 1oÝ÷ ÚÈhºW[y«¢+Ø1½°ÀÌØíÕ1¸ô}U% ÑɱI¥¡¥Ñ}ÑQáÑ1¹Ñ ÀÌØí¡}I¥¡¥Ð°QÉÕ¤¬ ...chris Edited January 2, 2009 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
ProgAndy Posted January 2, 2009 Author Share Posted January 2, 2009 No, if the count is not returned exactly, it is always GREATER than the actual value. But my error was to set the buffer Length in chars instead of bytes. This works fine for ANSI, but not for Unicode strings ;( Fixed it and added _GUICtrlRichEdit_GetNumbering *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes 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