Need help adding a Rich Edit control to a GUI.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Za3root

Need help adding a Rich Edit control to a GUI.

08 Apr 2015, 14:15

Hi all :D

So I am using the Rich Edit class which can be found here. But I am having problem adding it to a GUI. I've read the Sample but I didn't understand how the user added the rich edit control.

So if I want to add a Rich Edit control to the GUI should I write:

Code: Select all

RE  := New RichEdit(RE, Options)
Where "Options" is a variable containing the X,Y Position, width, and height of the RE I want to create?

And if I want to call a method should I just use:

Code: Select all

RE.Method()
I tried this but it didn't work.

Code: Select all

#Include Class_RichEdit.ahk

Options := x468 y177 w662 h349
RE := New RichEdit(1, Options)
GUI,Show
Sorry, but I'm still new to Objects and Classes.
Za3root
Posts: 3
Joined: 08 Apr 2015, 14:20

Re: Need help adding a Rich Edit control to a GUI.

08 Apr 2015, 14:25

Sorry, I didn't mean to post this in the Scripts and Functions section. I meant to post it in the Ask for Help section.

Sorry again :(
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Need help adding a Rich Edit control to a GUI.

08 Apr 2015, 15:15

You have to create a Gui before you add a Rich Edit control.
Za3root
Posts: 3
Joined: 08 Apr 2015, 14:20

Re: Need help adding a Rich Edit control to a GUI.

08 Apr 2015, 15:55

Hi Just Me,

First of all, Thanks for creating this class.

I already have a GUI. I didn't understand how did you add the Rich Edit control in your sample script.

I've only seen creating a Rich edit control using this:

Code: Select all

If !IsObject(RE1 := New RichEdit(1, Options, False)) {
   MsgBox, 16, Error, %ErrorLevel%
   ExitApp
}
Thanks in advance.
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Need help adding a Rich Edit control to a GUI.

09 Apr 2015, 03:26

You have to pass the number/name of an already existing Gui as the first parameter of the__New() method, otherwise the control won't be created.

Code: Select all

#NoEnv
#Include Class_RichEdit.ahk
SetBatchLines, -1
Gui, +LastFound ; this will create the Gui 1 if it doesn't exist <<<<<
Options := "x20 y20 w600 h400"
RE := New RichEdit(1, Options) ; create in Gui number 1 <<<<<
Gui, Show, , RichEdit
Return
GuiClose:
ExitApp
Doesn't it work for you?
Za3root
Posts: 3
Joined: 08 Apr 2015, 14:20

Re: Need help adding a Rich Edit control to a GUI.

09 Apr 2015, 04:11

Thanks a lot Just Me.

It worked!

I didn't know I have to pass the GUI's number as the first parameter.

Finally it worked! It's time to try some of it's features :D

Thanks again!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: coder96, RandomBoy, Rohwedder and 170 guests