Combobox value not selected in popup list

I got a simple combobox (not editable; user selects an element from the popup list). In case the selected element is beyond the number of elements shown within the popup list, the first element in the popup is selected.

In order to explain the situation:

I got a combo where the user selects a year between 1950 and 2050. The popup list shows 10 elements.

In case the selected year is between 1950 and 1959, the selected year appears highlighted in the list when the user presses the down-arrow.

However, selecting a higher year, the first element is selected in the popup list.

In other words, when popping up the list, this list does not scroll to the selected element.

The funny thing is that the problem appears in our test environment where we have CE version 10.16 while in our development environment, where we still have version 10.14, the problem does not occur.

Screenshot with the correct popup:

Screenshot showing the error:

Parents
  • Hi Robert,

    I got a simple combobox

    what about to follow the best practices and to specify product, its exact version and language / API used?

    There are at least 4 completely different ways (API  / technologies) how dialog and controls (like the discussed combo box) can be created: MicroStation resources, MFC, WinForms, NET WPF.

    Especially when combo box is created using MicroStation resources, I recommend also to share its .r definition.

    the problem appears in our test environment where we have CE version 10.16 while in our development environment, where we still have version 10.14, the problem does not occur.

    Do you use the same compiled form in both version or it is compiled separately using SDK CE U14 and SDK CE U16?

    With regards,

      Jan

  • First of all, sorry I didn't provide all necessary information.

    The combobox is defined in a .r file as follows:

    DItem_ComboBoxRsc CBID_DatePickerYear =
    {
      NOCMD, LCMD, NOSYNONYM, NOHELP, MHELP,
      HOOK_DatePicker_CB_MY, NOARG,
      4, "%s", "%s", "", "", NOMASK,
      0, 10, 0, 8*XC, 0,
      COMBOATTR_READONLY,
      "",
      "",
      {
        {8*XC, 4, 0, ""},
    	}
    };
    

    As you can see, I don't use a published variable to set or get the selected item. I'm quite allergic to global variables and therefore prefer to use the mdlDialog_comboBoxGet/SetIndex functions.

    I updated my development environment (both CE as the SDK) to 10.16 and now the problem occurs also there.

    The phenomena occurs in both modal and modaless dialogs.

    The most important part is:

    The problem occurs if and only if the data is inserted by means of a StringList. When using the ListModel everything works correctly.

  • I don't use a published variable to set or get the selected item. I prefer to use the mdlDialog_comboBoxGet/SetIndex functions.

    When you use the MDL Dialog Manager, which is invoked automatically when you publish a variable, it handles synchronisation for you.  Your procedural code must substitute for everything that the Dialog Manager would do for you.

    The problem occurs if and only if the data is inserted by means of a StringList. When using the ListModel everything works correctly

    StringLists are so 20th century.   You can do so much more, and more easily, with a ListModel.  It's possible that the developers aren't paying too much attention to bugs in StringLists.  

    Your ComboBox is managed by a hook function (HOOK_DatePicker_CB_MY).  Can you post that function?

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon,

    The hook function only reads the selected year by means of mdlDialog_comboBoxGetIndex which returns the correct value.

    The problem only occurs on display when opening the popup list in case the selected index is beyond the number of visible rows.

    I guess I just need to change a zillion lines of code for every combobox that uses a string list.

    As usual, thank you so much for your help.

  • I just need to change a zillion lines of code for every combobox that uses a string list.

    The ListModel template class describe here makes life simpler. 

    • It assumes that you use a hook class rather than a hook function
    • It uses a C++ template to make the same code work for both ListBox and ComboBox

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data