Class RichEdit - update on 2015-04-14 (v0.1.05.00)

Post your working scripts, libraries and tools for AHK v1.1 and older
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

30 May 2015, 01:51

Hi BGM,

I'm still trying to understand what you're doing. Why do you use pre-built RTF for coloring?
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

30 May 2015, 08:45

Just Me - because am basically treating the edit control like a syntax highlighter.
Instead of using scintilla (which I can't find a simple example for) I am colourizing characters manually using rtf coding.
It's working pretty well, actually.
User avatar
rommmcek
Posts: 1473
Joined: 15 Aug 2014, 15:18

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

31 May 2015, 12:09

Hi arcticir,

Try this out in WordPad:

Code: Select all

#NoEnv
#Persistent
SetTitleMatchMode, 2

SetTimer , CatWalk, 500
return

CatWalk:
IfWinActive, - WordPad
{
 SendMessage 0xB7, 0, 0, RICHEDIT50W1, - WordPad
 if A_CaretY > 520
  SendMessage, 0x115, 1, 0, RICHEDIT50W1, - WordPad
 else if A_CaretY < 500
  SendMessage, 0x115, 0, 0, RICHEDIT50W1, - WordPad
}
return
And this in Poor Man's Rich Edit:

Code: Select all

#NoEnv
#Persistent

SetTimer , CatWalk, 500
return

CatWalk:
IfWinActive, Poor Man's Rich Edit ; ahk_class AutoHotkeyGUI
{
 SendMessage 0xB7, 0, 0, RICHEDIT50W2, Poor Man's Rich Edit
 if A_CaretY > 280
  SendMessage, 0x115, 1, 0, RICHEDIT50W2, Poor Man's Rich Edit
 else if A_CaretY < 260
  SendMessage, 0x115, 0, 0, RICHEDIT50W2, Poor Man's Rich Edit
}
return
You may want add Hotkey for fine tuning CatWalk position without reediting the script!
If you want to in corporate scrpit in to RichEdit_sample.ahk ask "just him", I couldn't made it!

bye
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

31 May 2015, 20:29

Regarding methods of syntax highlighting, I have started a new thread, in case anyone is interested.

Methods of Syntax Highlighting
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

02 Jun 2015, 22:21

Just a few questions. I'm trying to put my own RichEdit together without using your class (don't want too much boilerplate), which is great as a reference.
  1. Why are you calling EM_SETTYPOGRAPHYOPTIONS and EM_SETLANGOPTIONS?
  2. Under what circumstances would you need to ; Correct AHK font size setting, if necessary?
  3. Why are you limiting the text length to 2147483647 characters?
  4. Is there a function to enable a default context menu?
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

03 Jun 2015, 02:14

Hi GeekDude,

honestly, I can't remember in any case why I did what I did. While testing the original script and the new version I frequently ran into issues. Whenever it happened I tried nearly all I could think of to solve the issue. That's why the script might contain unnecessary code.
  1. EM_SETTYPOGRAPHYOPTIONS might be unnecessary when passing 0x01, because it might be the default behaviour.
    MSDN wrote:Advanced line breaking is turned on automatically by the rich edit control when needed, such as for handling complex scripts like Arabic and Hebrew, and for mathematics. It’s also needed for justified paragraphs, hyphenation, and other typographic features.
    For EM_SETLANGOPTIONS see here. If you don't need/want it, don't use it.
  2. As far as I remember AHK font settings might create font sizes with decimals. It might confuse the user, that's why I round the size if needed.
  3. 2147483647 is the highest positive value which can be passed by AHK U32. I never tried if higher limits are possible and never reached this limit. But:
    MSDN wrote:Before EM_EXLIMITTEXT is called, the default limit to the amount of text a user can enter is 32,767 characters.
    Source
  4. I don't know.
DigiDon
Posts: 178
Joined: 19 May 2014, 04:55
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

15 Sep 2015, 17:02

Hello just me (been a time!)

As I am still working on my software which integrate your class and an ever more tweaked version of your Rich Note Editor, I would like to know if you could please open a separate topic for the editor?
I would be glad to share improvements and to gather innovations from and for other members. I remember that you didn't want topics not directly concerning the class itself to be published here.
If you don't want to because you want to focus on the class or other things, then please tell me and I would be glad to open a topic.
The topic would of course link this one for the class and this one could point to the other for the editor and related functions.

Be well :)
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation :thumbup:
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

16 Sep 2015, 01:39

Hello DigiDon!

Just post it here. I'll test it and add a link in the OP.

Regards!
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

23 Sep 2015, 12:42

Link to original post?
iPhilip
Posts: 814
Joined: 02 Oct 2013, 12:21

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

23 Sep 2015, 12:58

I too am interested in having images work properly with this awesome control. I don't know if it would be helpful, but I found this page that describes "A Rich Edit Control That Displays Bitmaps and Other OLE Objects" where the author describes a few tricks he used to make the control work for images.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - rich edit control for AHK (Unicode)

29 Sep 2015, 02:33

m3user wrote:Pasting images actually works on my Win 8.1 64bit, however not on Win 7. Any idea what might be the issue?
I wrote:Yes, with Win 8 new features where added to the rich edit control and others.
User avatar
Chunjee
Posts: 1418
Joined: 18 Apr 2014, 19:05
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

30 Sep 2015, 19:33

yes I saw those posts. Does anyone have an example or screenshot?

Does Win10 include this benefit?
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

01 Oct 2015, 02:21

Images.PNG
Yes, it works on Win 10.
Kliemann
Posts: 6
Joined: 20 Jan 2016, 09:07

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

20 Jan 2016, 09:24

Hi,
I want to use this class in a custom paragraph-oriented text control.
So, my question is: is there a simple way to get the paragraph number where the caret is at (i.e. the current paragraph), considering that one paragraph may use more than one line (word-wrap is set)?
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

20 Jan 2016, 15:59

Surprisingly, I neither found a 'simple way' nor a 'complicated'. But maybe I overlooked something.
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

20 Jan 2016, 16:05

Couldn't you use EM_GETSEL to get the caret position, then compare to the text contents counting the paragraphs with your own code?
Kliemann
Posts: 6
Joined: 20 Jan 2016, 09:07

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

21 Jan 2016, 10:20

I took a (fast) look at the Win API reference for the rich edit controls and also found nothing suggestive.
GeekDude, yes, that would be the 'complicated' way I was trying to avoid. The main issue in this case is that the RTF text is plenty of control tags that AFAIK must be manually cleaned up. Also, keeping the whole thing 'synchronized' all the time as the user edits the text figures out another issue...
Thanks anyway.
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

21 Jan 2016, 10:24

Another option could be to disable redraw, remove word wrap, check cursor position (which should now be line number), reenable word wrap, reenable redraw, and then do it on a line by line basis instead of character by character. Still complicated though, but perhaps a little less tedious.
Kliemann
Posts: 6
Joined: 20 Jan 2016, 09:07

Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)

21 Jan 2016, 11:24

Hummm... interesting option. That's far better.
Thanks.

BTW, how do I enable/disable auto redrawing of this object?

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 53 guests