Browse DevX
Sign up for e-mail newsletters from DevX


Review: Visual Data Solution's SmartCombo Control  : Page 3

Build powerful customized combo boxes with this new ActiveX control.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

You aren't limited to using PictureBoxes for the dropdown portion of the control--SmartCombo can display almost any control for which you can obtain a window handle. The documentation recommends that you use a container control, such as a PictureBox or Panel. You can even use the hWnd of another form, but only one on the same thread. You can make a SmartCombo combobox act more like a standard combobox by setting the dropdown portion to a ListBox control that you place on the screen. Finally, the documentation states that you can display menus from the current form or from another form in the dropdown portion, although I didn't test this feature.

Controlling the SmartCombo
When the user clicks the down arrow button on the SmartCombo control, call the DropDown method, and pass the hWnd of the window you want to display in the dropdown as the first parameter. The DropDown method has a number of additional parameters that let you control exactly how the control treats the dropdown portion. The following code shows a ButtonClick event handler with all the parameters. See Table 1 for an explanation.

Private Sub SmartCombo1_ButtonClick( _ ByVal ButtonID As VDSCOMBOLibCtl.vdsButtonID, _ ByVal SpinningEnded As Boolean) If ButtonID = vdsDownArrow Then SmartCombo1.DropDown List1.hWnd, _ vdsLeftToRight, vdsBottomToDown, vdsEdit, _ True, vdsRaisedResize, True, 0, 0 End If End Sub

Highly Configurable
In addition to the standard combobox's down-arrow button, the SmartCombo control has several other "buttons" that you can configure at either design time or at run time, including vertical and horizontal "spinner" buttons, a checkbox that appears within the edit portion, and a right-arrow button. The last SmartCombo on the sample form (see Figure 2) has all the available buttons visible and enabled. The up/down spinner buttons change a numeric value in the edit portion of the control. The left/right spinner buttons change the font size of the caption. The checkbox and right-arrow buttons simply display message boxes when you click them. The caption portion of the control also functions as a button.

Figure 2: The sample form's "Show Form" SmartCombo displays a different form as the dropdown portion of the control when a user clicks the down arrow button.

The various SmartCombo controls on the sample form display fixed and resizable borders. The fourth control "remembers" the last size set by the user. The "Show Matrix Example" button displays an example from the documentation that accompanies the control. Like Microsoft Word's table combo, this button lets you select a matrix of cells by moving the mouse over the control. If you hold the left mouse button down while you drag across the control, it resizes to show additional cells.

This control is very simple to use. It is extremely powerful and lets you add complex functionality to your user interfaces while minimizing screen space. I had a couple of odd experiences where the control refused to raise documented events, but removing the control and adding it back to the form eliminated the problem. I may have caused that by testing the control outside the bounds of its documented capabilities.

It's too bad this control wasn't available earlier in VB6's life cycle. I did test the control in VB.NET using COM Interop, which worked fine, although here you have to be more diligent in specifying values rather than accepting the defaults. I hope that Visual Data releases a .NET-compatible version soon. The documentation is adequate, although it could definitely be improved. I'd also like to see a few more properties and events added to the control. For example, it needs an event that fires before the dropdown portion closes.

It would be convenient if the control had a property that caused it to remember the window size for resizable dropdowns. And it would be nice if the control had properties that let you retrieve the size of the resizable dropdown (right now, you have to rely on the size of the contained window). All in all, despite the few minor glitches, I can recommend the SmartCombo control.

A. Russell Jones, Ph.D., is the Executive Editor for DevX. He's a former reptile keeper and professional musician who now composes computer applications. He's the author of Visual Basic Developer's Guide to ASP and IIS and Mastering Active Server Pages 3 (both published by Sybex). Reach him by e-mail at rjones@devx.com.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date