Page 7 of 11

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

Posted: 30 May 2015, 01:51
by just me
Hi BGM,

I'm still trying to understand what you're doing. Why do you use pre-built RTF for coloring?

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

Posted: 30 May 2015, 08:45
by BGM
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.

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

Posted: 31 May 2015, 12:09
by rommmcek
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

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

Posted: 31 May 2015, 20:29
by BGM
Regarding methods of syntax highlighting, I have started a new thread, in case anyone is interested.

Methods of Syntax Highlighting

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

Posted: 02 Jun 2015, 22:21
by geek
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?

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

Posted: 03 Jun 2015, 02:14
by just me
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.

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

Posted: 15 Sep 2015, 17:02
by DigiDon
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 :)

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

Posted: 16 Sep 2015, 01:39
by just me
Hello DigiDon!

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

Regards!

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

Posted: 23 Sep 2015, 12:39
by Chunjee

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

Posted: 23 Sep 2015, 12:42
by geek
Link to original post?

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

Posted: 23 Sep 2015, 12:58
by iPhilip
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.

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

Posted: 29 Sep 2015, 02:33
by just me
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.

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

Posted: 30 Sep 2015, 19:33
by Chunjee
yes I saw those posts. Does anyone have an example or screenshot?

Does Win10 include this benefit?

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

Posted: 01 Oct 2015, 02:21
by just me
Images.PNG
Yes, it works on Win 10.

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

Posted: 20 Jan 2016, 09:24
by Kliemann
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)?

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

Posted: 20 Jan 2016, 15:59
by just me
Surprisingly, I neither found a 'simple way' nor a 'complicated'. But maybe I overlooked something.

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

Posted: 20 Jan 2016, 16:05
by geek
Couldn't you use EM_GETSEL to get the caret position, then compare to the text contents counting the paragraphs with your own code?

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

Posted: 21 Jan 2016, 10:20
by Kliemann
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.

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

Posted: 21 Jan 2016, 10:24
by geek
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.

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

Posted: 21 Jan 2016, 11:24
by Kliemann
Hummm... interesting option. That's far better.
Thanks.

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