Your function should return the object it created on the form.
You will use that return value to set properties on.
You can use the AMembers() function to see all the available properties and
methods available. I will say my experience with COM objects the properties do
not show unless you have already accessed them.
Here is something I had written some time ago testing pageframes in pageframes.
I define the form adding a pageframe during the design.
In the forms init, I add the second pageframe and an editbox to the pageframe.
Then I add a combobox through a function to the first pageframe
Hope this gives you some ideas and directions.
Tracy
oTest = CREATEOBJECT("pageframeartifact")
oTest.SHOW()
oTest = .NULL.
CLEAR CLASS pageframeartifact
DEFINE CLASS pageframeartifact AS FORM
WINDOWTYPE = 1
CAPTION = "Active Page 2 of both pageframes - Pull down quickly"
ADD OBJECT pgf AS PAGEFRAME WITH ;
PAGECOUNT = 2, ANCHOR = 5, WIDTH = 450
PROCEDURE INIT
THIS.HEIGHT = 250
THIS.WIDTH = 450
THIS.pgf.page2.ADDOBJECT("pgf", "pageframe")
THIS.pgf.page2.pgf.HEIGHT = 100
THIS.pgf.page2.pgf.TOP = 116
THIS.pgf.page2.pgf.WIDTH = 450
THIS.pgf.page2.pgf.PAGECOUNT = 2
THIS.pgf.page2.pgf.ANCHOR = 14
THIS.pgf.page2.pgf.VISIBLE = .T.
THIS.pgf.page2.pgf.page2.ADDOBJECT("edt", "editbox")
THIS.pgf.page2.pgf.page2.edt.TOP = 10
THIS.pgf.page2.pgf.page2.edt.LEFT = 10
THIS.pgf.page2.pgf.page2.edt.WIDTH = THIS.WIDTH - 20
THIS.pgf.page2.pgf.page2.edt.HEIGHT = 60
THIS.pgf.page2.pgf.page2.edt.VISIBLE = .T.
LOCAL cmb
cmb = AddComboBox("cmb", this.pgf.Page1)
cmb.left = 20
cmb.top = 20
ENDPROC
ENDDEFINE
FUNCTION AddComboBox
LPARAMETERS comboboxName, containerClass as Container
containerClass.AddObject(comboboxName, "Combobox")
containerClass.&comboboxName..Visible = .T.
RETURN containerClass.&comboboxName.
ENDFUNC
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Joe Yoder
Sent: Tuesday, June 18, 2024 9:56 PM
To: [email protected]
Subject: Re: Combobox followup
Thanks guys! Now I can name and place Combos at will.
The next thing I would like to do is to update the ComboBox properties from
the program calling the creation procedure.
My first attempt was This,oComboBox1.rowsourcetype = '1 (value)' but it
fails (This can only be used within a method)
i also wish for a way to see all the properties of the created object. I
have read that some can only be accessed if a custom class has been defined
but I don't understand why that would be the case or how to figure out what
should be accessible.
Any help would be appreciated,
Joe
On Tue, Jun 18, 2024 at 5:42 AM <[email protected]> wrote:
> You should do it differently:
>
> toForm.AddObject(cName, "ComboBox")
> With toForm.&cName
> .AddItem(Item 1")
> .AddItem("Item 2")
> .Top = nTop
> .Left = nLeft
> .Visible = .T.
> Endwith
>
>
> wOOdy
>
> -----Ursprüngliche Nachricht-----
> Von: ProFox <[email protected]> Im Auftrag von Joe Yoder
> Gesendet: Dienstag, 18. Juni 2024 02:33
> An: [email protected]
> Betreff: Combobox followup
>
> Thanks Eric for the input. I think I have correctly made the changes you
> suggested but the code fails with "Unknown member oComboBox"
> Here is the code as I have it now:
>
> * Procedure to add a ComboBox to the form PROCEDURE
> AddComboBoxToForm(toForm, nTop, nLeft, cname)
> LOCAL oComboBox
> oComboBox = CREATEOBJECT("ComboBox")
> oComboBox.AddItem("Item 1")
> oComboBox.AddItem("Item 2")
> toForm.oComboBox.Top = nTop
> toForm.oComboBox.Left = nLeft
> toForm.oComboBox.Visible = .T.
> toForm.AddObject(cname, "oComboBox")
>
> ENDPROC
> For some reason I need to go to the archive to get any responses to my post
> so this will appear as a new thread.
>
> Thanks again,
> Joe
>
>
> --- StripMime Report -- processed MIME parts --- multipart/alternative
> text/plain (text body -- kept)
> text/html
> ---
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]
** 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.