Dynamically binding to an UltraComboEditor

Posted by ChUIMonster on 19-Feb-2009 13:31

I have an UltraComboEditor on a screen. It's very pretty. But empty.

The values that I wish to have drop down are in a temp-table. So I have done the following in my initialization code:

create query q.

q:set-buffers( buffer myTT ).

q:query-prepare( "preselect each myTT" ).

q:query-open.

...

myScreen:bindingSource5 = q.

myScreen:ultraComboEditor1:DisplayMember = "myField".

myScreen:ultraComboEditor1:DataBind().

and then, after building myTT:

myScreen:ultraComboEditor1:Refresh().

Unfortunately no amount of cursing (or fiddling with DataMember vs DisplayMember vs ValueMember) seems to convince the dropdown that it has any values to drop down (yes, myTT has data -- 12 rows to be exact...).

Obviously I am once again missing the secret decoder ring

All Replies

Posted by Peter Judge on 19-Feb-2009 13:38

I have an UltraComboEditor on a screen. It's very

pretty. But empty.

The values that I wish to have drop down are in a

temp-table. So I have done the following in my

initialization code:

create query q.

q:set-buffers( buffer myTT ).

q:query-prepare( "preselect each myTT" ).

q:query-open.

...

myScreen:bindingSource5 = q.

you need both

myScreen:BindingSource5:Handle = q

and

ultraComboEditor1:DataSource = myScreen:bindingSource1.

myScreen:ultraComboEditor1:DisplayMember =

"myField".

myScreen:ultraComboEditor1:DataBind().

d then, after building myTT:

myScreen:ultraComboEditor1:Refresh().

fortunately no amount of cursing (or fiddling with

DataMember vs DisplayMember vs ValueMember) seems to

convince the dropdown that it has any values to drop

down (yes, myTT has data -- 12 rows to be exact...).

Obviously I am once again missing the secret decoder

ring

-- peter

Posted by Admin on 19-Feb-2009 13:38

Have you set myScreen:ultraComboEditor1:DataSource to myScreen:bindingSource5?

Posted by Admin on 19-Feb-2009 13:41

Two fools - same reply - same minute

Posted by ChUIMonster on 19-Feb-2009 13:43

Typo. I did have :handle. And the datasource = bindingsource is also in there, I forgot to show it

Posted by Admin on 19-Feb-2009 13:45

Did you try the UltraCombo instead? I once had an issue with UltraComboEditor not showing all records.

Posted by ChUIMonster on 19-Feb-2009 13:47

Got it!

I needed to re-open the query just prior to the refresh(). Duh.

Posted by Admin on 19-Feb-2009 13:48

Just to be on the safe side: What does q:NUM-RESULTS show?

Posted by ChUIMonster on 19-Feb-2009 14:12

12.

Funny you should mention not getting all the items in the combo-box. I have it sort of working now but, as you suggested happened to you, it is only showing 4 items. I even set MaxDropDownItems to 20 with no success

Progress is easy. This Windows stuff is Byzantine.

Posted by Tim Kuehn on 19-Feb-2009 14:16

Progress is easy. This Windows stuff is Byzantine.

You just need to complete your transformation from a ChUIMonster into a GUIMonster.

Posted by Admin on 19-Feb-2009 14:22

Try tra UltraCombo (not the UltraComboEditor). That should make a difference.

Posted by ChUIMonster on 19-Feb-2009 14:23

Yes. The UltraCombo shows all the rows. Kind of ugly though. But I suppose if I spend some time with the properties I can clean that up

Posted by Admin on 19-Feb-2009 14:26

Peter, have you seen that difference as well? Any explanation why the UltraComboEditor skips/drops some rows (and add a few empty rows) and the UltraCombo does work as expected?

Is there already a bug logged for this or are we doing something wrong?

Posted by Peter Judge on 19-Feb-2009 15:26

Peter, have you seen that difference as well? Any

explanation why the UltraComboEditor skips/drops some

rows (and add a few empty rows) and the UltraCombo

does work as expected?

I do not (have an explanation, that is). I do see this behaviour, and also with the System.Windows.Forms.ComboBox.

I have a workaround (other than to use the UltraCombo).

Is there already a bug logged for this

There's an old one, but I'd suggest you contact TS about this.

>or are we

doing something wrong?

Doesn't look like it. This time, at least

-- peter

Posted by Admin on 19-Feb-2009 15:35

I have a workaround (other than to use the

UltraCombo).

If you don't need to Sync with the CurrencyManager (i.e. automated reposition of the query based on the combo value) that works as a workaround.

>or are we

doing something wrong?

Doesn't look like it. This time, at least

You're sure?

Posted by Peter Judge on 19-Feb-2009 15:56

>or are we

doing something wrong?

Doesn't look like it. This time, at least

You're sure?

Well, I'm not going to argue with a 1000+ poster

-- peter

Posted by Admin on 20-Feb-2009 03:49

There's an old one, but I'd suggest you contact TS

about this.

Logged with support as: W902200013

Posted by Admin on 21-Feb-2009 13:04

Tech support logged a Bug for this. They found out that using a ProDataset instead of a query works as expected for both combo box types.

Posted by Admin on 05-May-2009 05:43

Hi,

does anyone have an example of how to actually databind an UltraCombo using a pro dataset?

Thanks.

Posted by Peter Judge on 05-May-2009 07:21


does anyone have an example of how to actually databind an UltraCombo using a pro dataset?

Drop a ProBindingSource onto the form (you can give it a schema if you like, but don't - strictly speaking - need to).

On the SmartTag, set bindingSource1 as the Data Source for the UltraComboEditor.

In code, somewhere after the InitializeComponent call in the form's constructor, associate the binding source with the dataset:

bindingSource1:Handle = hProDataset /* or dataset dsData:handle */

And you should be good to go.

-- peter

Posted by Admin on 05-May-2009 08:48

Hi,

Thanks for that. I am however still struggling to get any data into my ultraCombo.

I've included the source below. I apologise if I've done something stupid!

The message block indicates the data is actually there!

  DEFINE TEMP-TABLE ttCustomer NO-UNDO
    FIELD TRADING_PARTNER_NUMBER AS INTEGER
    FIELD CUSTOMER_REFERENCE AS CHARACTER. 
 
  DEFINE DATASET hDset FOR ttCustomer.


  DEFINE DATA-SOURCE srccustomer FOR Customer.

.........

    bindingSource1 = NEW  Progress.Data.BindingSource().

    BUFFER ttCustomer:ATTACH-DATA-SOURCE(DATA-SOURCE srccustomer:HANDLE).
    DATASET hDset:FILL().
    BUFFER ttCustomer:DETACH-DATA-SOURCE().
   
   
    FOR EACH ttCustomer:
      MESSAGE CUSTOMER_REFERENCE
      VIEW-AS ALERT-BOX.

    END.
   
    bindingSource1:Handle = DATASET hDset:HANDLE.
    ultraCombo1:DataSource = bindingSource1.
   
    ultraCombo1:DataBind().
   
    ultraCombo1:Refresh().

Posted by Peter Judge on 05-May-2009 09:05


    bindingSource1 = NEW  Progress.Data.BindingSource().

    BUFFER ttCustomer:ATTACH-DATA-SOURCE(DATA-SOURCE srccustomer:HANDLE).
    DATASET hDset:FILL().
    BUFFER ttCustomer:DETACH-DATA-SOURCE().
   
   
    FOR EACH ttCustomer:
      MESSAGE CUSTOMER_REFERENCE
      VIEW-AS ALERT-BOX.

    END.
   
    bindingSource1:Handle = DATASET hDset:HANDLE.
    ultraCombo1:DataSource = bindingSource1.
   
    ultraCombo1:DataBind().
     ultraCombo1:Refresh().

I  would swap these lines.

    bindingSource1:Handle = DATASET hDset:HANDLE.
    ultraCombo1:DataSource = bindingSource1.

The last 2 lines are not necessary.

-- peter

This thread is closed