Author Topic: textBoxDialog Question  (Read 4733 times)

rdsuel

  • Community Member
  • Posts: 10
  • Hero Points: 0
textBoxDialog Question
« on: June 10, 2008, 04:46:08 pm »
Anyone know how to add multiple options to the drop down boxes (prompt1 ... promptN) in a textBoxDialog?  The documentation says the following:

The prompt string argument are strings in the following format:

options label[: initial_value]


It's probably obvious, but I can't figure out how to add more than a single value to the drop down box.  What I need is a generic dialog box that allows the user to slect from a few options preferably in a drop-down box.

Here is the code:

Code: [Select]
   _str result = show('-modal _textbox_form',
                      'Select Command Proc Type', // Dialog box caption
                      TB_RETRIEVE_INIT, // Flags
                      '', // Use default text box width
                      '', // Help item
                      '', // Button list
                      '', // Retrieve name
                      'Select One:Option1\nOption2\nOption3'); // First prompt

The resulting dialog box has a combo box with the caption "Select One:", and the text in the combo box is "Option1\nOption2\nOption3", instead of three different options in the drop down box.


Thanks
« Last Edit: June 10, 2008, 06:18:33 pm by rdsuel »

Graeme

  • Senior Community Member
  • Posts: 2300
  • Hero Points: 302
Re: textBoxDialog Question
« Reply #1 on: June 11, 2008, 12:07:01 pm »
You can't specify multiple strings for the combo box.  If you specify a non-empty string for the RetrieveName parameter, the combo boxes will be populated with "history" consisting of previous values that the user of your form has entered in the text box.  If you don't specify a retrieve name, the combo box will have only one item in it - the value you supply.  If you want to fiddle with the code in mprompt.e _ok.on_create  - a 600 line function  - you can probably do it.  Look for the call to _create_window() where the first parameter is OI_COMBO_BOX.  The call to _retrieve_prev_form() is what populates the combo box.  You could possibly create an on_load event handler for the form and iterate through the controls to find the combo boxes but it's probably easier to create your own form.

If you want to present a list, you could try _sellist_form.  Have a look at example3() in examples.e and see _sellist_form in the help.

Graeme

rdsuel

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: textBoxDialog Question
« Reply #2 on: June 11, 2008, 01:00:48 pm »
Thanks Graeme.  I think the _sellist_form should do what I need.

-rdsuel