CatFelix
2017-08-07T07:27:35Z
I am trying to produce a data entry form on which combo boxes will behave as is illustrated on the attached file. The screen shot illustrated here is of combos on an OpenOffice Calc spreadsheet. I am redeveloping this application to run on MS Office and want to use a userform for data entry instead of a spreadsheet.
  ExpenseScreen.docx (186kb) downloaded 44 time(s).
The Application is in
  Trans.xlsm (32kb) downloaded 41 time(s).

A. Background

I have 2 issues - one is a design issue; the other is that the program crashes.
Design
As iGrid only supports single level comboboxes, I firstly attempted to get around this limitation through use of a VBA combobox as the second level combo. But I had to abandon this approach as I could find no way of displaying the VBA combo on top of iGrid. Whenever I moved it to hopefully sit on the grid it disappeared behind it.
To overcome this issue I introduced a second form, the soul purpose of which was to house a combobox which I could then display on iGrid. The attached application shows how this works.

B. To Run the Application

1. Run the ExpenseEntry macro from the Macros button in the Code Group of the Excel Developer Ribbon
2. Select any cell in the A/C Name Column
3. Press Dropdown Button
4. Select one of the accounts (Level 1) presented
5. Press Dropdown button on combobox presented (Level 2)
6. Select SubAccount

C. What Is Desired to Happen

The selected subaccount should be presented in the cell originally selected in the A/C Name Column and both comboboxes should be closed

D. What actually happens

The First Level Account selected in The A/C Name Column is presented in the A/C Name Cell and the program crashes!!

Are there any suggestions on the approach and if I have to stick with this approach, (i) why does the program crash when the selection is made on the second level Combo and (ii) how do I get the value selected from the second level combo and passed back to the iGrid1_BeforeCommitEdit event to update the Level 1 TextComboCell.

Thanks for any help offered.
CatFelix
2017-08-07T22:44:18Z
I have resolved the issue of assigning the Level 2 combo selection to the level 1 Combo cell by assigning
Form1.F1CB.Value = Form2.F2CB.value in the F2CB_Change event.
I have also resolved the program crash issue. This was due to incorrect modal definitions for the forms. With both defined as non modal the program doesn't crash.

However this has now brought me back to square one - the issue of order of forms and controls on a screen. Unfortunately a form with an iGrid which uses combo cells always seems to want to be on top. The demo program now flashes the Form2 form with its combobox on top of Form1 (which contains the grid). This is exactly what I want if only it would stay there. Unfortunately it immediately disappears behind Form1.

In this file   overlappingFormsWithGrid.xlsm (21kb) downloaded 41 time(s). I've produced a simpler illustration of what is happening.

If you run this program with the grid cells generated but use the VBA combobox (Form1.F1CB) to show Form2 with its F2CB combo control, everything works OK. However as soon as you use an iGrid ComboBox, Form2 disappears behind Form1.

Is there any way around this? Or should I look for some other means of building my form?
Igor/10Tec
2017-08-08T12:21:53Z
Thank you for the sample - I could reproduce that strange behavior using it. Internally in iGrid we use the native Windows combobox functionality to implement our drop-down lists. My understanding of all this is that when we display a drop-down list in iGrid (by sending the CB_SHOWDROPDOWN message to the corresponding internal WinAPI combo box object), the OS itself tries to bring the grid control and form containing the API combo box to the top to display the drop-down list over all windows on the screen. Unfortunately, I can't overwrite this behavior.

May I ask you, why do you use such complex constructions in your interface? I can suggest two other approaches how you can implement what you need a simpler way.

The first option is to implement two columns with combos instead of one as we demonstrate it in the 'One-to-many combos' sample in the iGrid Extra Samples Library .

If you must provide only one column to select a value from the predefined list, put all values into one list imitating a two-level hierarchy and disable the selection of parents in the BeforeCommitEdit event. We do something like this in our My Customers sample in the main demo:

Country-2-level-dropdown-list.png

Click to View Image42 View(s)



In the list above, the user can't select the ===America=== and ===Europe=== items.
CatFelix
2017-08-08T20:50:50Z
Thanks Igor,

At least I now know where I stand. I'll give some more thought to how I want to implement this data entry form.
Similar Topics
Users browsing this topic