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

Post your working scripts, libraries and tools
Guest
Posts: 56
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: 7285
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
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 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
just me
Posts: 6513
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: 7285
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
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 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
arcticir
Posts: 578
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: 578
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.
just me
Posts: 6513
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: 578
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: 6513
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: 6513
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: 578
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: 6513
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: 578
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: 6513
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: 182
Joined: 18 Apr 2014, 19:05
GitHub: Chunjee

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: 6513
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. ;)
User avatar
joedf
Posts: 7285
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

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

06 Jan 2015, 16:19

:facepalm: touché...
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
iPhilip
Posts: 422
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 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Google [Bot] and 65 guests