Jump to content

RichEdit Control


GaryFrost
 Share

Recommended Posts

Well then this would do if you got the RICHTEXT.RichtextCtrl.1 component from MS RICHTX32.OCX library 'should be located in system32'. It's a Microsoft Rich Textbox Control that can be embedded into any autoit gui as a normal Edit control with cut, copy and paste using SvenP's nice activeX inveriment...

Rich text ( RTF ) is a standard formalized format by Microsoft Corporation for specifying formatting of documents. RTF files are actually ASCII files with special commands to indicate formatting information, such as fonts and margins...

Try run the previous example script, I included the link to the GUID information page in the example gui, just click at 'Visit tags page'

Rich text is not that easy to deal with as you has to point in the starting/ending spot at every color/font changes BUT you have a lot of options like 'Dot in selection', background / foreground colors, Bold / Italic, font size all in the same text and the component can save all on disk to be read in MSWord or another Rich text compative viewer ec.

There is a lot of different Rich components around all with different tags and area fields like one can display pictures and another has interactive hot spots available but common is that they are activex components and has to be available on disk and activated...

There is one way to overrule the activeX system though and that is to embed a browser and use this as a Rich component then no library has to be activated on the local computer as browsers use Inet connection to activate the nessesary componets ( DCOM's ), I offen use the CWebpage.dll library from Jeff Glatt as a short cut to do this 'run around', then all is available HTML, DHTML, SMIL, ActiveX and Java...

kjactive :whistle:

Edited by kjactive
Link to comment
Share on other sites

  • 1 month later...
  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 5 months later...

Started playing around with this a bit more, had a few minutes.

Supports urls

Added:

_GUICtrlRichEditAppendText

_GUICtrlRichEditInsertText

_GUICtrlRichEditGetText

_GUICtrlRichEditGetSel

_GUICtrlRichEditSetSel

_GUICtrlRichEditGetLineCount

_GUICtrlRichEditLineIndex

_GUICtrlRichEditLineLength

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

just some question , i cant delete the rtf box :)

if you have the handle to it maybe

Local $v_ret = DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $h_rtf)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Started playing around with this a bit more, had a few minutes.

Supports urls

Added:

_GUICtrlRichEditAppendText

_GUICtrlRichEditInsertText

_GUICtrlRichEditGetText

_GUICtrlRichEditGetSel

_GUICtrlRichEditSetSel

_GUICtrlRichEditGetLineCount

_GUICtrlRichEditLineIndex

_GUICtrlRichEditLineLength

Yes gary! Go ahead. :)

If i can help you with more functionality tell me. I mean especially _GUICtrlRichEditSetFormat()

I will help you if you will have some troubles and if I can.

I'm not so good expert but I wish to be also helpfull instead of only demanding.

Thanks

Edited by Zedna
Link to comment
Share on other sites

Yes gary! Go ahead. :)

If i can help you with more functionality tell me. I mean especially _GUICtrlRichEditSetFormat()

I will help you if you will have some troubles and if I can.

I'm not so good expert but I wish to be also helpfull instead of only demanding.

Thanks

By all means help if you want.

I won't have time to work on it anymore till after next week, I have + intense certificate training and test all next week.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 1 month later...

Help: do you mean in standard UDF format?

I will look at it...

If you make a udf then GuiRichEdit has Func OnAutitExit. This seems like a bad idea to me. Maybe it could be be changed to something like GuiRichEditClose and the script which uses the file could add that function to it's own OnAutoitExit function.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 2 months later...

Have a look at piccaso's callback function, I believe he has a rich edit example http://www.autoitscript.com/forum/index.php?showtopic=50768

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • 5 months later...

Is there any chance to make Rich Edit control wrap the text? i mean the same as the Wrap option in many text editors, that removes the horizontal scroll.

It would be perfect if this can be toggled by function...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Is there any chance to make Rich Edit control wrap the text? i mean the same as the Wrap option in many text editors, that removes the horizontal scroll.

It would be perfect if this can be toggled by function...

If you have the style $WS_HSCROLL included at design time then apparently it won't wordwrap.

(see here).

This link also has a suggestion for a work-around for toggling.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

If you have the style $WS_HSCROLL included at design time then apparently it won't wordwrap.

Thank you! how i could forgot about the styles?! :)

About the toggling... this is what i have tried base on the info from the link that you gave:

;Flag = -1 -> Toggling
;Flag = 0 -> Remove $WS_HSCROLL style
;Flag <> -1 And Flag <> 0 -> Set WS_HSCROLL style
Func _GUICtrlRichEditToggleWrapLines($h_RichEdit, $iFlag=-1)
    Local Const $GWL_STYLE = -16
    Local Const $GWL_EXSTYLE = -20
    Local Const $SWP_NOMOVE = 0x2
    Local Const $SWP_NOSIZE = 0x1
    Local Const $SWP_SHOWWINDOW = 0x40
    Local Const $SWP_NOZORDER = 0x4
    
    Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER)
    
    Local $nOld_Style = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $h_RichEdit, "int", $GWL_STYLE)
    $nOld_Style = "0x" & Hex($nOld_Style[0], 8)
    
    Local $nNewStyle = $nOld_Style
    
    Switch $iFlag
        Case -1
            If BitAND($nOld_Style, $WS_HSCROLL) Then
                $nNewStyle -= $WS_HSCROLL
            Else
                $nNewStyle += $WS_HSCROLL
            EndIf
        Case 0
            If BitAND($nOld_Style, $WS_HSCROLL) Then $nNewStyle -= $WS_HSCROLL
        Case Else
            If Not BitAND($nOld_Style, $WS_HSCROLL) Then $nNewStyle += $WS_HSCROLL
    EndSwitch
    
    DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $h_RichEdit, "int", $GWL_STYLE, "int", $nNewStyle)
    
    DllCall("User32.dll", "int", "SetWindowPos", _
        "hwnd", $h_RichEdit, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", $iFlags)
EndFunc

But as they mention...

removing of WS_HSCROLL style at run-time does not affect word-wrapping.

;)

I really don't like the idea of two Rich Edit controls...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thank you!

NP.

how i could forgot about the styles?! :)

I find it quite easy.

I really don't like the idea of two Rich Edit controls...

No, but beggars can't be choosers.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

beggars can't be choosers.

You are right, but i am not a beggar :) and we always have a choice ;)

;$iFlag = 0 -> Remove $WS_HSCROLL style
;$iFlag <> 0 -> Set $WS_HSCROLL style
Func _GUICtrlRichEditToggleWrapLines($hWnd_Parent, ByRef $h_RichEdit, $iFlag=0)
    Local $nNewStyle = $ES_WANTRETURN+$ES_SUNKEN+$ES_MULTILINE+$WS_VSCROLL+$ES_AUTOVSCROLL+$WS_BORDER
    
    If $iFlag <> 0 Then $nNewStyle += $WS_HSCROLL
    
    ;Get current selection positions, edit control positions, and the edit content
    Local $aSelection_Pos = _GUICtrlRichEditGetSel($h_RichEdit)
    Local $aEdit_Pos = ControlGetPos($hWnd_Parent, "", "[CLASSNN:RichEdit20A1]")
    Local $sEdit_Content = ControlGetText($hWnd_Parent, "", "[CLASSNN:RichEdit20A1]")
    
    ;Destroy the Rich Edit window
    DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $h_RichEdit)
    
    ;Create it again with new (toggled) style
    $h_RichEdit = _GUICtrlRichEditCreate($hWnd_Parent, $aEdit_Pos[0], $aEdit_Pos[1], $aEdit_Pos[2], $aEdit_Pos[3], $nNewStyle)
    
    _GUICtrlRichEditSetText($h_RichEdit, $sEdit_Content)
    If IsArray($aSelection_Pos) Then _GUICtrlRichEditSetSel($h_RichEdit, $aSelection_Pos[1], $aSelection_Pos[2])
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

You are right, but i am not a beggar :) and we always have a choice ;)

;$iFlag = 0 -> Remove $WS_HSCROLL style
;$iFlag <> 0 -> Set $WS_HSCROLL style
Func _GUICtrlRichEditToggleWrapLines($hWnd_Parent, ByRef $h_RichEdit, $iFlag=0)
    Local $nNewStyle = $ES_WANTRETURN+$ES_SUNKEN+$ES_MULTILINE+$WS_VSCROLL+$ES_AUTOVSCROLL+$WS_BORDER
    
    If $iFlag <> 0 Then $nNewStyle += $WS_HSCROLL
    
    ;Get current selection positions, edit control positions, and the edit content
    Local $aSelection_Pos = _GUICtrlRichEditGetSel($h_RichEdit)
    Local $aEdit_Pos = ControlGetPos($hWnd_Parent, "", "[CLASSNN:RichEdit20A1]")
    Local $sEdit_Content = ControlGetText($hWnd_Parent, "", "[CLASSNN:RichEdit20A1]")
    
    ;Destroy the Rich Edit window
    DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $h_RichEdit)
    
    ;Create it again with new (toggled) style
    $h_RichEdit = _GUICtrlRichEditCreate($hWnd_Parent, $aEdit_Pos[0], $aEdit_Pos[1], $aEdit_Pos[2], $aEdit_Pos[3], $nNewStyle)
    
    _GUICtrlRichEditSetText($h_RichEdit, $sEdit_Content)
    If IsArray($aSelection_Pos) Then _GUICtrlRichEditSetSel($h_RichEdit, $aSelection_Pos[1], $aSelection_Pos[2])
EndFunc
Yes, perhaps that is better than having 2 RE's.

I think the lines which add styles are unsafe IMO. I think it is better to have

Local $nNewStyle = BitOr($ES_WANTRETURN,$ES_SUNKEN,$ES_MULTILINE,$WS_VSCROLL,$ES_AUTOVSCROLL,$WS_BORDER)
    
    If $iFlag <> 0 Then $nNewStyle = BitOr($nNewStyle, $WS_HSCROLL)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I think the lines which add styles are unsafe IMO. I think it is better to have

To be honest, i have never got problems when i used + instead of BitOR, i know that there is a different, and i will appreciate if you (or someone) could explain to me how the BitOR really works here.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...