RichEdit.ahk (caret position, readonly, SetBgColor) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

RichEdit.ahk (caret position, readonly, SetBgColor)

12 Nov 2016, 05:30

Hi Community :wave:

Please help me :)

What I need and what I tried:
;---------------------------------------------
For background change:
MyRichEdit.SetBgColor(a9f874)
;---------------------------------------------
Positioning caret at 0 character
MyRichEdit.ScrollPos(PosString=0)
MyRichEdit.ScrollPos(0)
Text will be added to bottom of the richedit control, but the caret should be at top.
• After adding text also we can position the caret
MyRichEdit.SetText(clipboard)
;---------------------------------------------
ReadOnly
I also would like to make the edit control of richedit +readonly, means I should be able to append the results to edit control but user should not be able to change or delete it.
MyRichEdit := NEW RICHEDIT(%appname%,"w1000 h600 vmyedit +readonly")
* after appending results we can make it readonly afterwards also.
;---------------------------------------------

Thanks in advance for your help and support.

Code: Select all

Gui, +Hwnd%appname%
#include %A_ScriptDir%\Class_RichEdit.ahk
Gui, Add, Text, Hello
MyRichEdit := NEW RICHEDIT(%appname%,"X10 Y10 H300 W500")
Gui, Show, Center h320 w520, %AppName%
Sleep 1000
MyRichEdit.SetText(clipboard, ["SELECTION"])
Sleep 1000
; new code

Return

f2::
MyRichEdit.SetText(clipboard, ["SELECTION"])
Return
Last edited by ahklearner on 12 Nov 2016, 14:34, edited 1 time in total.
just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: RichEdit.ahk (caret position, readonly, SetBgColor)  Topic is solved

12 Nov 2016, 06:14

I suppose you're using my class, do you? I don't know which script maul-esel's documentation refers to.
  • For background change:
    MyRichEdit.SetBkgndColor(0xa9f874) ; must be an integer value (RGB) or an AHK color name (string)
  • Positioning caret at 0 character:
    MyRichEdit.SetSel(0, 0)
    and if you need to scroll the caret into view:
    MyRichEdit.ScrollCaret()
    or for caret position 0,0:
    MyRichEdit.SetScrollPos(0, 0)
  • ReadOnly:
    MyRichEdit.SetOptions(["READONLY"], "Or")
There's a RichEdit_sample.ahk script on GitHub which might give you some hints.
ahklearner
Posts: 313
Joined: 23 Jan 2015, 01:49

Re: RichEdit.ahk (caret position, readonly, SetBgColor)

12 Nov 2016, 06:30

Thank You once again "just me"

I am using the same "AHK-just-me/Class_RichEdit" from github.

I think while googling for examples on richedit I got "http://maul-esel.github.io".
Kliemann
Posts: 6
Joined: 20 Jan 2016, 09:07

Re: RichEdit.ahk (caret position, readonly, SetBgColor)

30 Jan 2017, 13:56

Is there a way I can scroll the view so that the line with the caret appears in the top of the richedit window?
just me
Posts: 9576
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: RichEdit.ahk (caret position, readonly, SetBgColor)

31 Jan 2017, 06:58

I suggest to use a combination of

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], bobstoner289, Google [Bot], peter_ahk, Spawnova and 349 guests