Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Well, up to now I couldn't figure out how to disable redrawing. Any clue???
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
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...
Code: Select all
cp := 0
SendMessage, 0xB0, &cp, 0, , % "ahk_id " . RE2.HWND
cp := NumGet(cp, 0, "UInt") + 1 ; Absolute caret position
s := RE2.GetText()
if (cp>1)
stringleft, s, s, % (cp-1)
else
s := ""
stringreplace, s, s, `r, `r, UseErrorLevel
paragraph := ErrorLevel+1
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)
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
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)
Hi Andreas,
do you speak German? If so, you'll find some hints in this german thread: Fragen zum RichEdit Control.
do you speak German? If so, you'll find some hints in this german thread: Fragen zum RichEdit Control.
- AlphaBravo
- Posts: 586
- Joined: 29 Sep 2013, 22:59
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
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.
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)
hy,
yes i'm fluent in german
and thanks again for your tip - after a nightshift yesterday it works ...
br from vienna
andreas
yes i'm fluent in german
![Wink ;-)](./images/smilies/icon_e_wink.gif)
br from vienna
andreas
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
zu früh gefreut, bei win10 tritt folgender fehler nach dem klicken auf eine mailadress auf (siehe screenshot). der aufruf ist simple:
cpMax := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 8, "Int")
URLtoOpen := GetTextRange(RE2.HWND, cpMin, cpMax)
Run, %URLtoOpen%
bei win7 ist alles gut (jeweils 64bit)
cpMax := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 8, "Int")
URLtoOpen := GetTextRange(RE2.HWND, cpMin, cpMax)
Run, %URLtoOpen%
bei win7 ist alles gut (jeweils 64bit)
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
@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.
@a-ber: I'm running Win 10 and will check it.
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
@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.
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)
here we are ...
Code: Select all
Options := "w500 h480 gRE2MessageHandler"
If !IsObject(RE2 := New RichEdit(1, Options)) ; define window
{
MsgBox, 16, Error, %ErrorLevel%
ExitApp
}
RE2.SetEventMask(["LINK"])
RE2.SetOptions(["READONLY"], "SET")
; RE2.AutoURL(1)
RE2.WordWrap(1)
Code: Select all
RE2MessageHandler:
If (A_GuiEvent = "N") {
Msg := NumGet(A_EventInfo + 0, A_PtrSize * 2, "Int")
If (Msg = 0x0702) { ; EN_SELCHANGE
Return
}
If (Msg = 0x070B) { ; EN_LINK
Message := NumGet(A_EventInfo + 0, A_PtrSize * 3, "Int")
If (Message = 0x0202) { ; WM_LBUTTONUP
wParam := NumGet(A_EventInfo + 0, (A_PtrSize * 3) + 4, "UPtr")
lParam := NumGet(A_EventInfo + 0, (A_PtrSize * 4) + 4, "UPtr")
cpMin := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 4, "Int")
cpMax := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 8, "Int")
URLtoOpen := GetTextRange(RE2.HWND, cpMin, cpMax)
Run, %URLtoOpen%
}
Return
}
} Else {
If (A_EventInfo = 0x0100) ; EN_SETFOCUS
HasFocus := True
Else If (A_EventInfo = 0x0200) ; EN_KILLFOCUS
HasFocus := False
}
Return
GetTextRange(HWND, cpMin, cpMax) {
Static EM_GETTEXTRANGE := 0x044B
Len := cpMax - cpMin ; Länge berechnen
VarSetCapacity(Text, Len << !!A_IsUnicode, 0) ; Bereich für den Text
VarSetCapacity(TEXTRANGE, 16, 0) ; TEXTRANGE Struktur
NumPut(cpMin, TEXTRANGE, 0, "UInt")
NumPut(cpMax, TEXTRANGE, 4, "UInt")
NumPut(&Text, TEXTRANGE, 8, "UPtr")
SendMessage, %EM_GETTEXTRANGE%, 0, % &TEXTRANGE, , ahk_id %HWND%
VarSetCapacity(Text, -1) ; Länge des Zeichenspeichers korrigieren
Return Text
}
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Hi a_ber,
I still cannot reproduce any problems here. Can you provide an example of your predefined RTF files?
I still cannot reproduce any problems here. Can you provide an example of your predefined RTF files?
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
hy, i changed the beginning of my script and now all the links (www and mail) work both in win10 & win7. but i have no clue why ![Wink ;-)](./images/smilies/icon_e_wink.gif)
btw, i also commented out "SendMode, Input", which caused problems in getting text under cursor.
you mentioned that "GetTextRange()" is now system built in, how look like the code instead?
thx & best regards
andreas
![Wink ;-)](./images/smilies/icon_e_wink.gif)
Code: Select all
Clipboard :=
;Send, ^{Left}+^{Right}^c ; get word under mouse/cursor
Send, {LButton 2}^c
ClipWait, 3
you mentioned that "GetTextRange()" is now system built in, how look like the code instead?
thx & best regards
andreas
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Code: Select all
RE2MessageHandler:
If (A_GuiEvent = "N") {
...
If (Msg = 0x070B) { ; EN_LINK
Message := NumGet(A_EventInfo + 0, A_PtrSize * 3, "Int")
If (Message = 0x0202) { ; WM_LBUTTONUP
wParam := NumGet(A_EventInfo + 0, (A_PtrSize * 3) + 4, "UPtr")
lParam := NumGet(A_EventInfo + 0, (A_PtrSize * 4) + 4, "UPtr")
cpMin := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 4, "Int")
cpMax := NumGet(A_EventInfo + 0, (A_PtrSize * 5) + 8, "Int")
URLtoOpen := RE2.GetTextRange(cpMin, cpMax) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Run, %URLtoOpen%
}
Return
}
-
- Posts: 313
- Joined: 23 Jan 2015, 01:49
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
Hi BGM ![O7 < I Salute thee! :salute:](./images/smilies/salute.gif)
Could you please help me with this.
RichEdit.ahk highlight help bold and red color https://autohotkey.com/boards/viewtopic.php?f=5&t=24339
Thank You
![O7 < I Salute thee! :salute:](./images/smilies/salute.gif)
Could you please help me with this.
RichEdit.ahk highlight help bold and red color https://autohotkey.com/boards/viewtopic.php?f=5&t=24339
Thank You
BGM wrote:Okay!
Here is a working SIMPLE example of using the RichText Class for folks who just want the basics.
It demonstrates:screenshot_AutoHotkey (AutoHotkey Unicode 32-bit)_005.png
- How to add the control
- How to use ToggleFontStyle (which I did find in the class file)
- How to colourize using richtext tags
- How to insert and clear text content
- How to fetch the content using the v-variable in the control's options
Code: Select all
#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)
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 OLE object = embedded objects of Powerpoint, Excel spreadsheet and other files!
Considering what I saw here :
https://www.codeproject.com/Articles/95 ... s-and-Othe
that might be possible !
By the way, it seems autoit has implemented it no?
https://github.com/forcedotcom/dataload ... chEdit.au3
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:![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Thanks !
![Wink ;)](./images/smilies/icon_e_wink.gif)
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 !
![Cool 8-)](./images/smilies/icon_cool.gif)
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 OLE object = embedded objects of Powerpoint, Excel spreadsheet and other files!
Considering what I saw here :
https://www.codeproject.com/Articles/95 ... s-and-Othe
that might be possible !
By the way, it seems autoit has implemented it no?
https://github.com/forcedotcom/dataload ... chEdit.au3
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
Well I will probably try a bit harder soon but I kindda su** at it so any help would be great ![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Thanks !
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
By the way here is a small contribution of my own
Insert clickable links of files by drag-and-drop
and add this in UpdateRNGui
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.
![Wink ;)](./images/smilies/icon_e_wink.gif)
Insert clickable links of files by drag-and-drop
Code: Select all
RichEditGuiDropFiles:
;Assuming you have the gui hwnd in RN_CurrentHwnd
FileDropped:=1
WinActivate, % "ahk_id " RN_CurrentHwnd
GuiControl, Focus, % RE2.HWND
RE2.SetSel(RE2.Sel.S,RE2.Sel.E)
Loop, parse, A_GuiEvent, `n
{
VariableToSend:="file://" . StrReplace(A_LoopField," ", "%20") . "`n"
RE2.LoadVariable(VariableToSend,"Insert")
}
FileDropped:=""
return
Code: Select all
if !(FileDropped)
RE2.Sel := RE2.GetSel()
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
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.
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)
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 !![Smile :)](./images/smilies/icon_e_smile.gif)
Support for OLE object = embedded objects of Powerpoint, Excel spreadsheet and other files!
https://www.codeproject.com/Articles/95 ... s-and-Othe
Support for images in Win 7:
https://www.autoitscript.com/forum/topi ... e-problem/
Friendly Hyperlink
https://blogs.msdn.microsoft.com/murray ... yperlinks/
https://stackoverflow.com/questions/425 ... -trichedit
AutoIt class (for reference)
https://github.com/forcedotcom/dataload ... chEdit.au3
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 !
![Smile :)](./images/smilies/icon_e_smile.gif)
Support for OLE object = embedded objects of Powerpoint, Excel spreadsheet and other files!
https://www.codeproject.com/Articles/95 ... s-and-Othe
Support for images in Win 7:
https://www.autoitscript.com/forum/topi ... e-problem/
Friendly Hyperlink
https://blogs.msdn.microsoft.com/murray ... yperlinks/
https://stackoverflow.com/questions/425 ... -trichedit
AutoIt class (for reference)
https://github.com/forcedotcom/dataload ... chEdit.au3
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
Re: Class RichEdit - update on 2015-04-14 (v0.1.05.00)
I have started an Ask For Help on these topics Here:
RichEdit : New Features to All
https://autohotkey.com/boards/viewtopic.php?f=5&t=43427
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
RichEdit : New Features to All
https://autohotkey.com/boards/viewtopic.php?f=5&t=43427
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: fertalizer and 243 guests