Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

cRichEdit - Standard RichEdit control for AutoHotkey scripts


  • Please log in to reply
110 replies to this topic
Supercalifragilistic
  • Guests
  • Last active:
  • Joined: --
Great release !!
An other wish : can you add to your align options the ability to justify the text at the left ans right margins?
Thanks for the good work

ABCYourWay
  • Guests
  • Last active:
  • Joined: --
Well, I thought I got almost everything I wanted.
Ow, Find or Search Function is needed.
Maybe the function should return the position of the found word.
To make it useful, GetCurrentPosition should also be requried, I think.
Cursor Positions could be expressed by [(line, colum)] or [the same way you already presented].

If possible, Edit control way would also be great as in AHK Help below.


LineCount: Sets OutputVar to be the number of lines in an Edit control. All Edit controls have at least 1 line, even if the control is empty.

CurrentLine: Sets OutputVar to be the line number in an Edit control where the caret (insert point) resides. The first line is 1. If there is text selected in the control, OutputVar is set to the line number where the selection begins.

CurrentCol: Sets OutputVar to be the column number in an Edit control where the caret (text insertion point) resides. The first column is 1. If there is text selected in the control, OutputVar is set to the column number where the selection begins.

Line, N: Sets OutputVar to be the text of line N in an Edit control. Line 1 is the first line. Depending on the nature of the control, OutputVar might end in a carriage return (`r) or a carriage return + linefeed (`r`n). If the specified line number is blank or does not exist, ErrorLevel is set to 1 and OutputVar is made blank.


I don't know how tricky it is, but when you find time, please consider it.

idiot
  • Guests
  • Last active:
  • Joined: --
Sorry, You've already done my request by selrange and setsel

I wish nobody saw that silly request. :oops:

Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
Thanks for you great work! I use RTF control in my last project "DupFinder" - <!-- m -->http://sven.karsten.googlepages.com/<!-- m -->
Can you please add "wrap lines" function?

And a little bug report now:
The function cRichEdit(REdit1, "GetRTF") not 100% correct works with big non-English texts.
Example: Copy from Internet big (1-2 Mb.) Russian text (here: <!-- m -->http://zhurnal.lib.r...messer1-1.shtml<!-- m --> ), open new RTF file in Wordpad, paste the Russian content and save as RTF. Than open this file in your RichEdit and save with
Content := cRichEdit(REdit1, "GetRTF")
FileDelete, output.rtf
FileAppend, %Content%, output.rtf
Content =
The result will be 3-4 Kb greater as input file, some random characters will be added to the text.

But with plain English texts your RichEdit works fine.

:D

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Thanks for you great work! I use RTF control in my last project "DupFinder" - <!-- m -->http://sven.karsten.googlepages.com/<!-- m -->
Can you please add "wrap lines" function?

Thanks :) . I'll add it to the list.

And a little bug report now:
The function cRichEdit(REdit1, "GetRTF") not 100% correct works with big non-English texts.

Thanks for the report. I'll have a look.

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

And a little bug report now:
The function cRichEdit(REdit1, "GetRTF") not 100% correct works with big non-English texts.

Sorry for the really long delay. This might be caused by the default flags that get used for the opt2 param of the GetRTF command.

GetRTF - Get the RTF code for the current selection or current contents of the RichEdit
control

_action = GetRTF
opt1 := True (optional) Retrieve the code for the current selection instead of the code
for the entire control (the entire control is the default if not specified)
opt2 := formatting flags (optional)
- will default to SF_TEXT|SF_RTF|SF_RTFNOOBJS|SFF_PLAINRTF if not specified

I tried to download your sample text but the link does not seem to be valid. I'm not sure if it will make a difference but you could try removing the SFF_PLAINRTF flag and add the SF_UNICODE flag. The call could then look something like this:
cRichEdit(REdit1, "GetRTF", False, 0x1|0x2|0x3|0x10)
This page gives a bit of an explanation of possible flags that can be used. Please let me know if this helps when you get a chance :) .

Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
Thank you corrupt!
I'll try to test it. :)

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Minor update: version 0.07[*:3rcxhkx6]added: GetLineNum - to retrieve the current line number, the total number of lines or the line number at a specific character index
[*:3rcxhkx6]fixed: bug with specifying a colour by name
[*:3rcxhkx6]more to come soon...

Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
Sorry, corrupt, but the test is negative...
It work not in Unicode mode too. :(

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Sorry, corrupt, but the test is negative...
It work not in Unicode mode too. :(

Thanks for giving it a try. Out of curiosity, have you checked to see if the file gets loaded in the control ok before trying to save?

Landvermesser
  • Members
  • 51 posts
  • Last active: Aug 12 2008 09:02 AM
  • Joined: 03 Nov 2004
Yes, your RTF-control loads and shows all files 100% correct. More as 6 Mb big and localized files too.

I can copy the controls content to clipboard, open hidden Wordpads window, paste and save all - and it works fine too.

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

Thanks for you great work! I use RTF control in my last project "DupFinder" - <!-- m -->http://sven.karsten.googlepages.com/<!-- m -->
Can you please add "wrap lines" function?

Thanks :) . I'll add it to the list.

Just to let you know that I too am interested in the "Wrap Lines" feature. I hoping that this won't be a tough one to add.

Keep up the good work!

Dragonscloud as guest
  • Guests
  • Last active:
  • Joined: --
Wow. This is the first time I've download functionality for external controls that has actually worked for me. I've been sidetracked on other stuff and am a newbie to ahk again, but I was able to make the control work. It took a little while to figure out why it wasn't working on my system at first, but the scripts were commented well enough that I could figure it out without much of a hassle.
I've been needing the RTF control for a while in a way that I could implement without having to burn out my last remaining brain cells. Thank you much for your work on this project.

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Thanks for the feedback :) . Any suggestions for the next release?

jballi
  • Members
  • 1029 posts
  • Last active:
  • Joined: 01 Oct 2005

Thanks for the feedback :) . Any suggestions for the next release?

I would like to use the module to display documentation. The "Wrap Lines" feature is what I'm waiting for.

Keep up the good work! :D