Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 28 Jan 2016, 07:19
by Kliemann
The wordwrap switching approach has some drawbacks, but after a while I came up with an 'acceptable' solution thanks to the possibility of obtaining the absolute caret position and to a particularity of the stringreplace function, which I could then use to quickly count the occurrences of carriage-returns in the plain text. However, this solution may not perform well on long texts (not tested yet). My code is below:
Now, for the next step, I am interested in a way to set the absolute caret position...
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 15 Mar 2016, 15:01
by a_ber
hy just me,
first, you app is really great! i use it to show dedicated information on a very simple rtf gui. my problem is to follow links (email adr. or www) shown in the gui. is there a possibility to make it happen? i use win 10 x64 and the latest ahk compiler.
best regards
andreas
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 17 Mar 2016, 11:40
by AlphaBravo
First off, great Class, thanks for sharing just me.
I just recently started messing with it and was wondering if it is possible to change text format without having to select it.
i.e. use RE.SetFont({BkColor: VarHasColor}) on a text by defining its start/end without changing current selection.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 17 Mar 2016, 12:20
by a_ber
hy,
yes i'm fluent in german and thanks again for your tip - after a nightshift yesterday it works ...
br from vienna
andreas
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 17 Mar 2016, 15:05
by a_ber
zu früh gefreut, bei win10 tritt folgender fehler nach dem klicken auf eine mailadress auf (siehe screenshot). der aufruf ist simple:
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 18 Mar 2016, 01:52
by just me
@AlphaBravo: You can change the text attributes either for the current selection or for text subsequently entered after the current caret position.
@a-ber: I'm running Win 10 and will check it.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 18 Mar 2016, 10:08
by just me
@a-ber:
I cannot reproduce the problem here (Win 10 x64). Would you please provide the complete code used in the message handler?
BTW: GetTextRange() is a built-in method now and I used it instead of your function call.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
#NoEnv
SetBatchLines, -1
#include Class_RichEdit.ahk
appname := "SimpleRichEdit"
gosub, mainui
gosub, loadhotkeys
return
;------------------------------
mainui:
Gui, +Hwnd%appname%
MyRichEdit := new richedit(%appname%,"w250 vmyedit", true)
MyRichEdit.AlignText("RIGHT")
Gui, Show, h120 w270 center,%appname%
Return
;------------------------------
Message:
guicontrolget, myedit
ToolTip, My contents are %myedit%
settimer, removemessage, 1000
return
RemoveMessage:
settimer, removemessage, off
tooltip
return
;------------------------------
LoadHotkeys:
hotkey, IfWinActive, % "ahk_id " %appname% ; <------
hotkey, ^b, MakeBold
hotkey, ^+b, MakeBold_alt
hotkey, ^g, MakeColoured
hotkey, ^t, Message
hotkey, ^q, Clear
return
;------------------------------
;For syntax using the richtext tags:
;http://www.pindari.com/rtf1.html
;Demonstrate using the class' built-in ToggleFontStyle for the current selection
MakeBold:
MyRichEdit.ToggleFontStyle("B")
return
;Demonstrate setting of tag-styled text
MakeBold_alt:
MyRichEdit.SetText("{\rtf My Name is \b1 " . appname . "\b0}", ["SELECTION"])
return
MakeColoured:
colortable := "{\colortbl `;\red0\green176\blue80;\red0\green77\blue187`;\red255\green0\blue0`;}"
greentext := "\cf1 green text,\cf0"
bluetext := "\cf2 blue text,\cf0"
redtext := "\cf3 red text\cf0"
MyRichEdit.SetText("{\rtf " . colortable . "Colouized text: " . greentext . bluetext . redtext . ".}", ["SELECTION"])
return
Clear:
MyRichEdit.SetText("")
return
;------------------------------
GuiClose:
ExitApp
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 25 Jan 2018, 15:42
by DigiDon
Hi just me, hello all,
I have been implementing this great class into a project for some time now.
I did a few improvements but mostly minors until now because I am not very at ease with msdn documentation.
However there are some more complicated features that I think would be really great to implement.
If someone is up for the challenges and could at least give a first try/look that would be wonderful !
Here what I think could be added/improved. What do you think about it?
@just me: do you think some of these are possible?
Support for images in Win 7:
I know this has been asked and answered that image support wworks on win>8 but for what I've read there might be the solution to load images as bitmap using Gdip so that win 7 would display images. https://www.autoitscript.com/forum/topi ... e-problem/
However I have not been able to even see a icon of the image using the class.
If I use RE2.SetEventMask(["DROPFILES"]) and/or set RichEditGuiDropFiles label, that doesn't seem to produce something.
Friendly Hyperlink
I have been like others be able to implement AutoURL detection but then you have to put the link as such.
It would be great to have a text independant from the link.
The best would be to be able to right clic it and even be able to enter a new label for the link after it has been added.
But first things first.
Here are some documentation https://blogs.msdn.microsoft.com/murray ... yperlinks/ https://stackoverflow.com/questions/425 ... -trichedit
I have given a try:
Spoiler
a simple label in the mehnu of the editor that would insert a user-friendly hyperlink
richlinkinsert:
RE%RN_CurrentHwnd%_2.SetText("{\rtf1{\field{\*\fldinst{ HYPERLINK "" http://www.msn.com/""}}{\fldrslt{ MSN} }}}",["SELECTION"])
return
It works but then I do not receive the WM_LINK message when hovering the link, only after reloading the file and control can I start using the link.
I thought it might require to update the "CFE_LINK "property of the link but couldn't make it work.
Also on stackoverflow and other sources they say:
send the RichEdit an EM_SETEVENTMASK message to enable the ENM_LINK flag. Do this once after the RichEdit has been created, and then do it again every time the RichEdit receives a CM_RECREATEWND message.
but I haven't been able to figure out if this plays a role, if it is needed in our case and what the hell is the equivalent of CM_RECREATEWND in ahk.
Well I will probably try a bit harder soon but I kindda su** at it so any help would be great
Thanks !
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
I have come to find this solution to get the Sel so that you can insert filelinks where you were and not just append them.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 25 Jan 2018, 17:28
by just me
Hi DigiDon,
I lost interest in maintaining this class furthermore. Do you want to continue? If so, open a new thread, please. I'll add a link to the new thread and ask the mods to close this one.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Posted: 26 Jan 2018, 07:34
by DigiDon
Hi everyone,
We've PMed with just me and I asked for some time before deciding to pick up the topic.
I would need some help because this goes beyound my capabilities right now. So the question is: Who could be interested in trying to improve this class with me on these topics? So please don't hesitate to contact me and/or post here if you think you could help with these subjects
Cheers !