Page 1 of 1

Add object to GetList?

Posted: Wed Oct 13, 2010 4:16 am
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?

Re: Add object to GetList?

Posted: Wed Oct 13, 2010 9:42 am
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