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

Post your working scripts, libraries and tools for AHK v1.1 and older
Guest
Posts: 57
Joined: 17 Oct 2013, 02:32

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

22 Aug 2014, 16:34

@just me: not to hijack this thread for a license discussion but you may recall learning one does this for a living (if I remember correctly) http://www.autohotkey.com/board/topic/9 ... /?p=585319 by default no license can indeed mean most people won't touch it (however silly it may sound) so why not slap a mit, wtfpl or "something" on your scripts so people will feel comfortable using it? See also https://help.github.com/articles/open-s ... -a-license
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

22 Aug 2014, 18:01

Then I would suggest either `Public Domain CC0` or `WTFPL` (http://www.wtfpl.net/), wtfpl2 http://wtfpl2.com/

Edit: whoops didn't see the post from Guest
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

23 Aug 2014, 00:58

Well, I added a license file on GitHub.
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

23 Aug 2014, 10:11

Ahh unlicense ! Perfect choice, just me! :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

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

24 Aug 2014, 08:31

Each update, I have to add their own code. You can keep it anyway?

Code: Select all

Class_RichEdit(h,d,b:=True){
	Return New RichEdit(h,d,b)
}

#Include %A_LineFile%\..\Class_RichEditDlgs.ahk
addition
How to set margins? Left and right sides Distance.
Thanks.

Beautiful code.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

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

24 Aug 2014, 11:57

Another question: Strange WordWrap(1).
This is a line, WordWrap it become like this.

Image



SetParaIndent()
SetBorder()
Can you help me write a function of these two parameters? I have been unable to correctly fill out.
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

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

25 Aug 2014, 22:07

https://github.com/G33kDude/MyRC/commit ... e2df9c5d3e

I implemented your RichEdit into my code. I'm particularly fond of my ToRTF and AppendChat functions.
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

26 Aug 2014, 03:39

Hi articir,
Each update, I have to add their own code. You can keep it anyway?
This has never been part of my scripts.
This is a line, WordWrap it become like this.
I don't see much words which the control could use for wrapping. Strange input -> strange output.
SetParaIndent()
The method is buggy. It will be fixed soon.
SetBorder()

Code: Select all

   SetBorder(Widths, Styles) { ; Set paragraph's borders
      ; Borders are not displayed in RichEdit, so the call of this function has no visible result.
      ; Even WordPad distributed with Win7 does not show them, but e.g. Word 2007 does.
      ...
You have to pass two arrays to the function, the first with up to 4 line width values in the order left, top, right bottom and the second with up to 4 styles in the same order.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

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

26 Aug 2014, 04:13

Thank you. :)

but I want to know, paragraph indents, two characters. Because I can not find methods.

AND, How to achieve this effect,edit Margins, This picture is AHK edit. I want to replace it Class RichEdit.
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

26 Aug 2014, 21:49

arcticir wrote:AND, How to achieve this effect,edit Margins, This picture is AHK edit. I want to replace it Class RichEdit.
If you used EM_SETMARGINS it will work for RichEdit controls, too.

The fix for indentation will be released soon.Th update will contain a changed example to demonstrate how to call the method.
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

27 Aug 2014, 04:25

Well, indentation should work now. I fixed the SetParaIndent() method and changed the indentation sample. All indents are specified in centimeters/inches depending of the system/user settings. To see the all effects you have to switch to the Wrap as printed (WYSIWYG) view.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

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

27 Aug 2014, 05:25

Thanks.

===================
I have been tested , found 1 and -1 will set a normal indentation.
but I did not find that setting margins. :eh:
my English is very poor, not judge you words, can be set or not set.

Image
Image
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

07 Sep 2014, 01:47

Hi arcticir,

I overlooked your last post, sorry!
just me wrote:
arcticir wrote:AND, How to achieve this effect,edit Margins, This picture is AHK edit. I want to replace it Class RichEdit.
If you used EM_SETMARGINS it will work for RichEdit controls, too.
EM_SETMARGINS is actually working:

Code: Select all

...
EM_SETMARGINS(RE2.HWND, 60, 60) ; will set the left and right margin to 60 pixel
WinSet, Redraw, , % "ahk_id " . RE2.HWND
...
; ----------------------------------------------------------------------------------------------------------------------
EM_SETMARGINS(Hwnd, Left := "", Right := "") {
   ; EM_SETMARGINS = 0x00D3 -> http://msdn.microsoft.com/en-us/library/bb761649(v=vs.85).aspx
   Set := 0 + (Left <> "") + ((Right <> "") * 2)
   Margins := (Left <> "" ? Left & 0xFFFF : 0) + (Right <> "" ? (Right & 0xFFFF) << 16 : 0)
   Return DllCall("User32.dll\SendMessage", "Ptr", HWND, "UInt", 0x00D3, "Ptr", Set, "Ptr", Margins, "Ptr")
}
Alternatively you can change the control's formatting rectangle with EM_SETRECT. With it you can set top and bottom margins, too:

Code: Select all

...
EM_GETRECT(RE2.HWND, L, T, R, B)
EM_SETRECT(RE2.HWND, 60, 60, R - 60, B - 60) ; will set all margings to 60 pixel.
WinSet, Redraw, , % "ahk_id " . RE2.HWND
...
; ----------------------------------------------------------------------------------------------------------------------
EM_GETRECT(HWND, ByRef Left, ByRef Top, ByRef Right, ByRef Bottom) {
   ; EM_GETRECT = 0x00B2 -> http://msdn.microsoft.com/en-us/library/bb761596(v=vs.85).aspx
   VarSetCapacity(RC, 16, 0)
   DllCall("User32.dll\SendMessage", "Ptr", HWND, "UInt", 0x00B2, "Ptr", 0, "Ptr", &RC, "Ptr")
   Left := NumGet(RC, 0, "Int"), Top := NumGet(RC, 4, "Int")
   Right := NumGet(RC, 8, "Int"), Bottom := NumGet(RC, 12, "Int")
   Return True
}
EM_SETRECT(HWND, Left, Top, Right, Bottom) {
   ; EM_SETRECT = 0x00B3 -> http://msdn.microsoft.com/en-us/library/bb761657(v=vs.85).aspx
   VarSetCapacity(RC, 16, 0)
   NumPut(Left, RC, 0, "Int"), NumPut(Top, RC, 4, "Int")
   NumPut(Right, RC, 8, "Int"), NumPut(Bottom, RC, 12, "Int")
   DllCall("User32.dll\SendMessage", "Ptr", HWND, "UInt", 0x00B3, "Ptr", 0, "Ptr", &RC, "Ptr")
   Return True
}
In either case you have to switch to the Word-wrap view to see the effect. And, if you use EM_SETRECT, you should restore the original formatting rectangle before you switch to the Wrap as printed view.
arcticir
Posts: 693
Joined: 17 Nov 2013, 11:32

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

08 Sep 2014, 09:01

Thank you.
This is what I need. :)
Guest

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

02 Jan 2015, 20:11

tmplinshi wrote:
Chef wrote:Hello just me,

Can you make it load pictures too?
+1 :)
Any chance of this? Images that is. Thanks
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

03 Jan 2015, 01:09

I wrote:Honestly, I've already tried without success, because it is one of the things I'm missing, too. But it seems that pictures included by Word or WordPad are not just 'not displayed' but, even worse, stripped from the RTF on loading. I don't know whether this is a script issue or a control feature. Sorry, I don't have a clue!
No progress.
User avatar
Chunjee
Posts: 1400
Joined: 18 Apr 2014, 19:05
Contact:

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

06 Jan 2015, 11:30

Don't know if there is a better place/way to post this but I'll offer a $30 paypal bounty if someone wants to get images working correctly.

Thanks for the class just me.
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

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

06 Jan 2015, 15:50

I want to "get images working correctly".
So you might pay just me. ;)
iPhilip
Posts: 801
Joined: 02 Oct 2013, 12:21

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

12 Mar 2015, 23:42

Hi just me,

Is it possible to use your class on existing rich edit controls generated from other apps? If so, could you give me some advice as to how to go about it?

Thank you,

iPhilip
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: charlie89, gwarble and 126 guests