Re: Obj reference to most recently added control

Author: Ken Dibble

Posted: 2014-04-09 at 19:25:19

>It's gotta be this.CreateObject(), I think. Otherwise it won't be a control

>owned by the form. I dpn't think this.CreateObject() returns anything.

Containers don't have a CreateObject() method, they only have AddObject()

and NewObject().

1. You could issue DODEFAULT(Parms...) in one of those methods and then add

code to that method to return a reference to the object added:

PROCEDURE AddObject()

PARAMETERS cName, cClass, Init1, Init2, ...

DODEFAULT(cName,cClass,Init1,Init2...)

RETURN THIS.&cName.

ENDPROC

2. You could, as suggested, manipulate the object immediately after it's added:

THIS.AddObject("oBlah","ClassBlah")

WITH THIS.oBlah

....etc.

ENDWITH

3. You could increment a counter property on the container object and

concatenate its value to the name of the object when you add it, so you

will always be able to find the most recently-added object by the appended

digit(s).

PROCEDURE AddObject

PARAMETERS cName, cClass, Init1, Init2, ...

NODEFAULT

cName = TRANSFORM(THIS.ObjectCounter) + cName

THIS.ObjectCounter = THIS.ObjectCounter + 1

DODEFAULT(cName,cClass,Init1,Init2...)

ENDPROC

4. You could do number 3, above, using a timestamp instead of a number.

Ken Dibble

www.stic-cil.org

>-Lew Schwartz

>

>

>On Wed, Apr 9, 2014 at 4:32 PM, Allen <profox@gatwicksoftware.com> wrote:

>

> > If there are many can you use createobject? Then you have your reference

> > Al

> >

> > -----Original Message-----

> >

> > Guess I should have added that there will be many image controls on this

> > form. I need a way to work with the most recently added one individually.

> >

> >

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/5.2.1.1.1.20140409201354.01c6d4b8@POP-Server.stny.rr.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2014 Ken Dibble