I have been trying to come up with simple code to let me generate and
configure ComboBoxes in code.  I have succeeded in creating one combo and
controlling its top and left properties by passing parameters but when I
try to pass in a name things don't work.  Here is the procedures code in a
file named Try:

* Procedure to create a form
PROCEDURE CreateForm
    PUBLIC oForm
    oForm = CREATEOBJECT("Form")
    oForm.Caption = "My Form"
    oForm.Show()
ENDPROC

* 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.AddObject("oComboBox", (cname))
    toForm.oComboBox.name = cname
    toForm.oComboBox.Top = nTop
    toForm.oComboBox.Left = nLeft
    toForm.oComboBox.Visible = .T.
ENDPROC

The code that calls it in a file named Joe follows:

* Call the procedures from the first file
DO try  && load the procedures

* Create a form
CreateForm()

* Add a ComboBox to the form at position (40, 40)
AddComboBoxToForm(oForm, 40, 40, "oComboBox1")

* Add a second ComboBox to the form at position (80, 80)
AddComboBoxToForm(oForm, 80, 80, "oComboBox2")

I have been working with CoPilot to generate the code but it keep telling
me that I need to create a custom class using the visual tools.  I would
appreciate a second opinion from real experts!

Thanks in advance,
Joe


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: ProFox@leafe.com
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/cabqednxqg6o7fjxs_3ha0vaphntqwojtnluntp2c-5y6rby...@mail.gmail.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.

Reply via email to