Jump to content
Sign in to follow this  
GaryFrost

RichEdit Control

Recommended Posts

Thought I would see if it could be done, and yes it can

Just started it last night, don't have time right now to finish it, only made 2 functions for it so far.

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

Supports urls

Added:

_GUICtrlRichEditAppendText

_GUICtrlRichEditInsertText

_GUICtrlRichEditGetText

_GUICtrlRichEditGetSel

_GUICtrlRichEditSetSel

_GUICtrlRichEditGetLineCount

_GUICtrlRichEditLineIndex

_GUICtrlRichEditLineLength

;===============================================================================
;
; Description:   _GUICtrlRichEditCreate
; Parameter(s):  $h_Gui   - Handle to parent window
;      $x    - The left side of the control
;      $y    - The top of the control
;      $width   - The width of the control
;      $height   - The height of the control
;      $v_styles  - styles to apply to the control (Optional) for multiple styles bitor them.
;      $v_exstyles  - extended styles to apply to the control (Optional) for multiple styles bitor them.
; Requirement:
; Return Value(s):   Returns hWhnd if successful, or 0 with error set to 1 otherwise.
; User CallTip:   _GUICtrlRichEditCreate($h_Gui, $x, $y, $width, $height, [, $v_styles = -1[, $v_exstyles = -1]]) Creates RichEdit Control.
; Author(s):         Gary Frost (gafrost (custompcs@charter.net))
; Note(s):
;===============================================================================
_GUICtrlRichEditCreate(ByRef $h_Gui, $x, $y, $width, $height, $v_styles = -1, $v_exstyles = -1)

;===============================================================================
;
; Description:   _GUICtrlRichEditSetText
; Parameter(s):  $h_RichEdit - Handle to the control
;      $s_Text   - Text to put into the control
; Requirement:
; Return Value(s):   If the operation is setting all of the text and succeeds.
;                               he return value is 1
;                If the operation is setting the selection and succeeds, 
;                               the return value is the number of bytes or characters copied.
;                If the operation fails, the return value is zero.
; User CallTip:   _GUICtrlRichEditSetText($h_Gui, $s_Text) Put text into the RichEdit Control.
; Author(s):         Gary Frost (gafrost (custompcs@charter.net))
; Note(s):
;===============================================================================
_GUICtrlRichEditSetText(ByRef $h_RichEdit, $s_Text)

Gary

http://www.autoitscript.com/fileman/users/gafrost/projects/GUIRichEdit/RichEdit_Example.au3

http://www.autoitscript.com/fileman/users/gafrost/projects/GUIRichEdit/GuiRichEdit.au3

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Thanks, I'm sure a number of other people will appreciate this too!

Gene

Thought I would see if it could be done, and yes it can

Just started it last night, don't have time right now to finish it, only made 2 functions for it so far.

;===============================================================================
;
; Description:   _GuiCtrlRichEditCreate
; Parameter(s):  $h_Gui   - Handle to parent window
;      $x    - The left side of the control
;      $y    - The top of the control
;      $width   - The width of the control
;      $height   - The height of the control
;      $v_styles  - styles to apply to the control (Optional) for multiple styles bitor them.
;      $v_exstyles  - extended styles to apply to the control (Optional) for multiple styles bitor them.
; Requirement:
; Return Value(s):   Returns hWhnd if successful, or 0 with error set to 1 otherwise.
; User CallTip:   _GuiCtrlRichEditCreate($h_Gui, $x, $y, $width, $height, [, $v_styles = -1[, $v_exstyles = -1]]) Creates RichEdit Control.
; Author(s):         Gary Frost (gafrost (custompcs@charter.net))
; Note(s):
;===============================================================================
_GuiCtrlRichEditCreate(ByRef $h_Gui, $x, $y, $width, $height, $v_styles = -1, $v_exstyles = -1)

;===============================================================================
;
; Description:   _GuiCtrlRichEditSetText
; Parameter(s):  $h_RichEdit - Handle to the control
;      $s_Text   - Text to put into the control
; Requirement:
; Return Value(s):   If the operation is setting all of the text and succeeds.
;                               he return value is 1
;                If the operation is setting the selection and succeeds, 
;                               the return value is the number of bytes or characters copied.
;                If the operation fails, the return value is zero.
; User CallTip:   _GuiCtrlRichEditSetText($h_Gui, $s_Text) Put text into the RichEdit Control.
; Author(s):         Gary Frost (gafrost (custompcs@charter.net))
; Note(s):
;===============================================================================
_GuiCtrlRichEditSetText(ByRef $h_RichEdit, $s_Text)

Gary


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

Hi,

Looks fantastic.

Will I be able to get text out of rtf with this?

Starnge that the Obj control I can't get (permission prob?), but your dll works...?!

thanks, Randall

Currently, not that I know of, need to be able to do a EditStreamCallback callback with EM_STREAMIN, EM_STREAMOUT using a Pointer to an EditStreamCallback function


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Awesome! A richtext box that doesn't require an external DLL or an arbitrary license in the registry! Gafrost, you are the man. I can't wait to see what other functions can be done with this. If the method is truly independent of any non-standard Windows files, I wouldn't be surprised if we got a whole RichEdit UDF collection included in a beta version somewhere down the line. Nice work! :o

Share this post


Link to post
Share on other sites

Is there way to have the richedit control into a tab ?

i think i found a way to send formated text (fonts + colors).

Edited by Lemon.fr

Share this post


Link to post
Share on other sites

so you can create this jkust like a normal edit, and use more than one style/color/font in the same box?

awsome!


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

in Win98 a receive a error in linea 7:

Global Const $WM_USER = 0x400

"Can not redeclare a constant"

and if i comment this line the RichText not show in the form.

Share this post


Link to post
Share on other sites

Hello!

@ontosy: yes! on the new beta is $WM_USER already declard in "GuiConstants"! Delete this line simply!

@gafrost: looks nice! i think its better then the extra dlls/ocx files!

spider


www.AutoIt.de - Moderator of the German AutoIt Forum

 

Share this post


Link to post
Share on other sites

I don't think gafrost can get that to work yet. I may be wrong


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.

Share this post


Link to post
Share on other sites

so you can create this jkust like a normal edit, and use more than one style/color/font in the same box?

awsome!

possible? how?

[CENTER]Sorry for my bad English... ;)[/CENTER]

Share this post


Link to post
Share on other sites

I don't know if this is what you'r looking for but this example ativate an embedded Rich component with coloured text displayed, there is a lot of Rich componets around and all with different behave and options, some can even display graphis while other has interactive programable areas to interface with so...

; Author:   Kåre Johansson
; AutoIt Version: 3.1.1.55
; Description: Very Simple example: Embedding RICHTEXT object
; Needs: MSCOMCT2.OCX in system32 but it's probably already there
; Date: 3 jul 2005

#include <GUIConstants.au3>
#include <Word.au3>
$oRP = ObjCreate("RICHTEXT.RichtextCtrl")

GUICreate("Embedded RICHTEXT control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS))
$TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER)
GuiCtrlSetFont($TagsPageC,9,400,4)
GuiCtrlSetColor($TagsPageC,0x0000ff)
GuiCtrlSetCursor($TagsPageC,0)
$AboutC = GUICtrlCreateButton('About',105,177,70,20)
$PrefsC = GUICtrlCreateButton('FontSize',175,177,70,20)
$StatC = GUICtrlCreateButton('Plain Style',245,177,70,20)

$GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 400 , 260 )
GUICtrlSetPos($GUIActiveX,10,10,300,160)

With $oRP; Object tag pool
    .Backcolor = 2020255
    
    .Font = 'Garamond kursiv'
    
    .text = "Hello - Au3 supports ActiveX components like the RICHTEXT thanks to SvenP" & @CRLF & 'Try write some text and quit to reload'
    .SelStart = 0
    .SelLength = StringLen(.Text)
    .SelFontSize = 14
;If FileExists("C:\RichText.rtf") Then .LoadFile("C:\RichText.rtf", 0)
;.SaveFile("C:\RichText.rtf", 0)
    .Enabled = True
    .HideSelection = False
    .SelStart = 49
    .SelLength = 8; from start
    .SelColor = 1010
    .SelFontSize = 18
    .SelBold = True
    .SelItalic = True
    .SelUnderline = True
    .MousePointer = 14
    .SelBullet = True
EndWith

GUISetState ();Show GUI

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            $oRP.SaveFile("C:\RichText.rtf", 0 )
            ExitLoop
        Case $msg = $TagsPageC
            Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B7C8860-D78F-101B-B9B5-04021C009402}','', @SW_HIDE)
        Case $msg = $AboutC
            $oRP.AboutBox() 
        Case $msg = $PrefsC
            $oRP.SelFontSize = 12
        Case $msg = $StatC
            $oRP.SelBold = False
            $oRP.SelItalic = False
            $oRP.SelUnderline = False 
    EndSelect
WEnd
$oRP = 0
GUIDelete ()
Exit

kjactive :whistle:

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...