This article describes the DataSheet example project. DataSheet is written using C++ and the Microsoft Visual C compiler and linker. It is built using the Bentley Systems make tool bmake, and includes a bmake rule file datasheet.mke.

DataSheet demonstrates several aspects of C++ programming for MicroStation …

Much of the internal mechanism of DataSheet involves creating and manipulating ListModels. It provides practical answers to many questions that you may have about the mdlListModel_api.

Questions about ListModels sometimes appear on the MicroStation Programming Forum. For answers to those questions, visit our ListModels page.

DataSheet Project

DataSheet Dialog

Mark Anderson — now, alas, no longer with Bentley Systems — wrote the original DataSheet example when MicroStation V8 was young. His goal was to show how to use a ListBox to display a ListModel's contents in a dialog box, and how to create pop-up editors to modify the ListModel. We have taken this example a step further, and in the process ported DataSheet to MicroStation CONNECT using the MicroStationAPI and C++.

ListCell Editors

We show how to assign a ListCell editor to a ListModel. A cell editor provides an pop-up user input device, such as a text box, combo box or MicroStation ColorChooser. The editor appears automatically when a user clicks on a cell in the ListBox.

When the user finishes editing — tabs out or presses return — the editor is destroyed.

We also show how to display and modify a colour in a ListBox cell. The pop-up ColorChooser item lets a user choose a colour in a way that is familiar to MicroStation users..

DataSheet displays a ListBox with six columns. Each column uses a different cell editor. A cell editor is activated when a user clicks on a cell in the ListBox. The cell editors are set when the dialog first opens, driven by the ListBox _OnCreate event.

Simple Text Editor

Simple Text Editor

The simple text editor is a MicroStation dialog text item. Like the other cell editors, it activates when a user clicks a cell in the first column.

The _OnInit event handler copies the text currently in ListCell into the text item, where the user can edit it. When the user finishes, the _OnQueueCommand handler copies the content of the text item into the ListCell.

ComboBox Text Editor

ComboBox Text Editor

The ComboBox text editor provides the user with a predetermined list of text. Like the other cell editors, it activates when a user clicks a cell in the second column. User selects an item in the ComboBox list, which is copied to the ListCell by the _OnQueueCommand handler.

Boolean Editor

Boolean Editor

The Boolean editor provides the user with binary choice. The ListCell displays a raster icon rather than any text. Like the other cell editors, it activates when a user clicks a cell in the third column. The user choice sets an internal integer value in the ListCell, which determines what icon will be displayed.

Colour Editor

Colour Chooser

The colour editor provides the user with a palette of colours, in the form of the familiar MicroStation Color Chooser. The ListCell displays no text, but instead the foreground ListCell colour is modified. Like the other cell editors, it activates when a user clicks a cell in the fourth column. When user clicks a cell, the Colour Chooser is displayed. The Colour Chooser is owned by a Container, so the coding is a little more complex than the other hook classes.

Level List Editor

Level List Chooser

The Level List editor is a ComboBox that displays a list of MicroStation level names. Like the other cell editors, it activates when a user clicks a cell in the fifth column. When it opens, the code attempts to match the current ListCell content with a level name. When it closes, the current level name is copied to the ListCell display text.

Row-Specific Editor

Level List Chooser

The Row-Specific editor is a ComboBox that displays a list of text. The text is specific to the row that user clicked in the DataSheet ListBox. That is, depending on the ListBox row, the ComboBox will present a different list. Like the other cell editors, it activates when a user clicks a cell in the sixth column. When it closes, the current ComboBox text is copied to the ListCell display text.


Download

Download the DataSheet Project

You can download the DataSheet Project. DataSheet is written using C++ and the Microsoft Visual C compiler and linker. It is built using the Bentley Systems make tool bmake, and includes a bmake rule file datasheet.mke.

Return to MicroStationAPI articles index.