Page 4 of 11

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

Posted: 22 Aug 2014, 16:34
by Guest
@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

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

Posted: 22 Aug 2014, 18:01
by joedf
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

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

Posted: 23 Aug 2014, 00:58
by just me
Well, I added a license file on GitHub.

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

Posted: 23 Aug 2014, 10:11
by joedf
Ahh unlicense ! Perfect choice, just me! :)

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

Posted: 24 Aug 2014, 08:31
by arcticir
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.

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

Posted: 24 Aug 2014, 11:57
by arcticir
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.

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

Posted: 25 Aug 2014, 22:07
by geek
https://github.com/G33kDude/MyRC/commit ... e2df9c5d3e

I implemented your RichEdit into my code. I'm particularly fond of my ToRTF and AppendChat functions.

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

Posted: 26 Aug 2014, 03:39
by just me
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.

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

Posted: 26 Aug 2014, 04:13
by arcticir
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.

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

Posted: 26 Aug 2014, 21:49
by just me
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.

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

Posted: 27 Aug 2014, 04:25
by just me
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.

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

Posted: 27 Aug 2014, 05:25
by arcticir
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

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

Posted: 07 Sep 2014, 01:47
by just me
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.

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

Posted: 08 Sep 2014, 09:01
by arcticir
Thank you.
This is what I need. :)

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

Posted: 02 Jan 2015, 20:11
by Guest
tmplinshi wrote:
Chef wrote:Hello just me,

Can you make it load pictures too?
+1 :)
Any chance of this? Images that is. Thanks

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

Posted: 03 Jan 2015, 01:09
by just me
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.

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

Posted: 06 Jan 2015, 11:30
by Chunjee
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.

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

Posted: 06 Jan 2015, 15:50
by just me
I want to "get images working correctly".
So you might pay just me. ;)

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

Posted: 06 Jan 2015, 16:19
by joedf
:facepalm: touché...

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

Posted: 12 Mar 2015, 23:42
by iPhilip
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