Author Topic: Combo box programming  (Read 4617 times)

drawson

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Combo box programming
« on: June 06, 2008, 05:03:10 pm »
I'm need to fill the text box of a combo box with the contents of the first row of the list box . . . . so that, for example:

Listbox:
foo
bar
something

And when the dialog opens, it should say "foo" in the text box.  No matter what I do, I get the text box empty.

Am I missing something obvious??? 

Thanks!

Dan

Graeme

  • Senior Community Member
  • Posts: 2300
  • Hero Points: 302
Re: Combo box programming
« Reply #1 on: June 06, 2008, 08:01:45 pm »
Since you don't post any code or explain what you're doing it's impossible to tell what the problem is but to assign text to the text box of a combo control you use  p_cb_text_box.p_text = 'something;

Graeme

drawson

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Combo box programming
« Reply #2 on: June 09, 2008, 10:41:54 am »
Graeme -

Thanks . . . that did it -  code does this (the "myhosts" var is a static array):

void ctlhost_list.on_create()
{
    p_window_id = p_cb_list_box;
    _lbclear()
    for (i=0;i<myhosts._length();++i)
    {
       _lbadd_item(myhosts);
    }
    _lbtop();
    p_window_id = p_cb;
    p_cb.p_text = myhosts[0];
}

I found that setting the p_text property on the combo box itself seems to work best.

Thanks again!

Dan