Madza91 Posted September 8, 2008 Share Posted September 8, 2008 (edited) I have one reproach, your commands for adding text in RichEdit not supports UniCode Characters, demo: #Include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GuiRichEdit.au3> $GUI = GUICreate("bye",700,500) $hRichText = RichText_Create($GUI, 0, 0, 700, 500) RichText_InsertText($hRichText, "Hello everybody"& @CRLF) GUISetState() RichText_SetSel($hRichText, 6, 11); Pos 6 to 11 is 'every' RichText_SetColor($hRichText, 0x0000FF, True); True = colorize selection, False = colorize all. !!! Color codes is BGR !!! RichText_SetSel($hRichText, 20, 20); Set the selection to 0-0 RichText_InsertText($hRichText, ChrW(263)&" "&ChrW(269)) MsgBox(0, "Added characters:", ChrW(263)&" "&ChrW(269)) While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Edited September 8, 2008 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Kip Posted September 9, 2008 Author Share Posted September 9, 2008 I know. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Madza91 Posted September 9, 2008 Share Posted September 9, 2008 Do you know to fix that ? [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Kip Posted September 9, 2008 Author Share Posted September 9, 2008 Dont know sure, but i'll try. I though that the unicode version requires some changes. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
SxyfrG Posted September 9, 2008 Share Posted September 9, 2008 One quick suggestion ... Get the formatted RTF text from the control (RichText_GetText only returns unformatted text) Really good work, keep it up My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website Link to comment Share on other sites More sharing options...
Kip Posted September 10, 2008 Author Share Posted September 10, 2008 Should be doable with a EM_STREAMOUT message. Unicode text can be done with EM_STREAMIN. But I don't have much time to do it now. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted September 10, 2008 Share Posted September 10, 2008 (edited) I have some examples and an own RichEdit UDf, but not completly finished //Edit: If compiled as Unicde it will use Unicode to get/add text, otherwise ANSI ( CP_ACP) Edited September 10, 2008 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...
Madza91 Posted September 15, 2008 Share Posted September 15, 2008 (edited) Hello, i have a few new questions... 1. Is possible to made funcions fot setting color,bold,font etc.. without selecting text than to set start number of character and end for setting color,bold... something like this: RichText_SetColor($hRichText, $hColor, $i_start, $i_end) 2. Is possible to made func RichText_CharFromPos ( i tried but failed^^ ) 3. How to add hyperlink in this RichEdit ? I tried but i don't know how to control that hyperlink ^^ Func RichText_SetHyperlink($hWnd, $hBold = False, $iSelec = 0x01) Local $tcharformat, $pCHARFORMAT $tcharformat = _tagCHARFORMAT2() DllStructSetData ($tcharformat, "cbSize", DllStructGetSize($tcharformat)) DllStructSetData($tcharformat, "dwMask", $CFM_LINK) If $hBold Then DllStructSetData ($tcharformat, "dwEffects", $CFE_LINK) Else DllStructSetData ($tcharformat, "dwEffects", 0) EndIf $pCHARFORMAT = DllStructGetPtr($tcharformat) Return _SendMessage ($hWnd, $EM_SETCHARFORMAT, $iSelec, $pCHARFORMAT) EndFunc Edit: Sry for very bad english Edited September 15, 2008 by n3nE [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Kip Posted September 16, 2008 Author Share Posted September 16, 2008 1. Is possible to made funcions fot setting color,bold,font etc.. without selecting text than to set start number of character and end for setting color,bold... something like this: RichText_SetColor($hRichText, $hColor, $i_start, $i_end)You can't. Something that would do the same: RichText_PauseRedraw($hRichText) $aPos = RichText_GetSel($hRichText) RichText_SetSel($hRichText, $i_start, $i_end) RichText_SetColor($hRichText, $iColor) RichText_SetSel($hRichText, $aPos[1], $aPos[0]) RichText_ResumeRedraw($hRichText) 2. Is possible to made func RichText_CharFromPos ( i tried but failed^^ )A character pos, or X and Y pos? 3. How to add hyperlink in this RichEdit ? I tried but i don't know how to control that hyperlink ^^$EM_SETCHARFORMAT isnt a suported EM_SETCHARFORMAT mask. Try this: Func RichText_AutoURLDetect($hWnd, $iMode=True) Return _SendMessage ($hWnd, $EM_AUTOURLDETECT, $iMode, 0) EndFunc An EN_LINK notification will be send if a link is clicked. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Madza91 Posted September 18, 2008 Share Posted September 18, 2008 A character pos, or X and Y pos? Yes, same like for Edit. #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> $hwnd = GUICreate("Form1", 633, 447, -1, -1) $pic = GUICtrlCreatePic("", 0, 0, 600, 400) $Edit1 = GUICtrlCreateEdit("", 0, 0, 600, 400) GUICtrlSetData(-1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" &@CRLF& "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") $lbl = GUICtrlCreateLabel("", 20, 410, 200, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $pic $mpos = _WinAPI_GetMousePos(True, $hwnd) $pos = _GUICtrlEdit_CharFromPos($Edit1, DllStructGetData($mpos, "X"), DllStructGetData($mpos, "Y")) GUICtrlSetData($lbl, "Character pos: "&$pos[0] &@CRLF& "Line number: " & $pos[1]) _GUICtrlEdit_SetSel($Edit1, $pos[0], $pos[0]) EndSwitch WEnd [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Kip Posted September 19, 2008 Author Share Posted September 19, 2008 (edited) Have you tried _GUICtrlEdit_CharFromPos($hRichText, 100, 20) ? Almost all edit functions can be used with RichText. Edited October 28, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Yakumo500 Posted October 28, 2008 Share Posted October 28, 2008 Verry good I will use it in a chat. But how can I paste images in it? Link to comment Share on other sites More sharing options...
Madza91 Posted October 30, 2008 Share Posted October 30, 2008 Have you tried _GUICtrlEdit_CharFromPos($hRichText, 100, 20) ? Almost all edit functions can be used with RichText.Yes, and for every $x and $y i get same number of character and line...Why?! [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
ProgAndy Posted November 1, 2008 Share Posted November 1, 2008 (edited) Well, RichEdit needs other Parameter and return value is different ... Ii try to implement OLE interface in AuoIt. If i get it, i'll post my RichEdit UDF Edited November 1, 2008 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...
Madza91 Posted November 2, 2008 Share Posted November 2, 2008 Thank you for answer, I'm waiting for yout UDF :-) Btw... Just one more question for this RichEdit UDF, how to get selected text? I know for RichText_GetText, but it's for All text... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
au3scr Posted November 2, 2008 Share Posted November 2, 2008 (edited) Good job man, now give me example how to colorize text by givenword, for example, i want all words "FOR", "AND","NEXT" to be in blue color. How would i do that? Will this be added in next release of autoit? it would be nice. Edited November 2, 2008 by au3scr Link to comment Share on other sites More sharing options...
Kip Posted November 2, 2008 Author Share Posted November 2, 2008 The simplest way is to get all the text from the control. Place StringInStr() in a loop until it returns an error. And then colorize fom that position. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Madza91 Posted November 2, 2008 Share Posted November 2, 2008 Kip, where is answer on my question? I need to get only selected text... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) Link to comment Share on other sites More sharing options...
Kip Posted November 2, 2008 Author Share Posted November 2, 2008 RichText_GetText($hRichtext, $RICHTEXT_SELECTION) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Madza91 Posted November 2, 2008 Share Posted November 2, 2008 Not working... again I get all text from RichEdit, not selected... [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :) 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