Add object to GetList?

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Add object to GetList?

#1 Post by Tom »

Some ActiveX-components I use in my apps are created this way:

Code: Select all

@ n,n DCSAY '' SIZE x,y OBJECT oControlParent

...

DCREAD GUI ... EVAL {||oControl := CreateMyControl(oControl,oControlParent)}
A sample for this is the TX Text Control, which consists of up to four or five objects (the control itself, a ruler, a button bar and so on, each of them a single control, joined using handles). There is a unique function to create this set of controls, and the function also adds a context menu and stuff like this. I'd like to keep it this way, but the control(s) don't become part of the GetList, so AUTORESIZE a.s.o. don't react on them.

Is there a simple way to add those controls to the GetList, so the DCREADER reacts on them?
Or is this the best one:

Code: Select all

Aadd(GetList,DC_GetTemplate(GETLIST_ACTIVEX))
DC_GetListSet(GetList,abcnGetListOption,xOption) ... // for example: DC_GetListSet(GetList,nGETLIST_STARTROW,20)
Is this safe?
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Add object to GetList?

#2 Post by rdonnay »

Tom -

There are lots of ways to do this.

Your function can add items to the GetList in the same way that a complete document system is added to the GetList in the sample \exp19\samples\document\document.prg. In this sample, Document is a class and it is called from test.prg.

Another examples of multiple levels of abtraction that create a single Getlist is \exp19\samples\wizard.prg.

In your case, you want to make sure that the parent control or any other control used by your CreateMyControl() function are passed by reference.

Code: Select all

@ n,n DCSAY '' SIZE x,y OBJECT oControlParent

CreateMyControl( GetList, @oControl, @oControlParent )
...

DCREAD GUI

* ------------

FUNCTION CreateMyControl( GetList, oControl, oControlParent )

@ 10,10 DCACTIVEXCONTROL oControl SIZE DCGUI_PARENTWIDTH - 20, DCGUI_PARENTHEIGHT - 20 PIXEL PARENT oControlParent

RETURN nil

 
The eXpress train is coming - and it has more cars.

Post Reply