| featured products | ||
![]() |
![]() |
![]() |
The Exontrol's eXHelper tool helps you to find easy and
quickly the answers and the source code for your questions regarding the usage of our UI components.
The eXHelper is free to use for anyone that wants to start working with any of our UI component.
Click the programming language you use for general questions:
Click the programming language you use for how-to questions:
Listed below are the questions that we are asked quite often. Before you write us, be sure to check here.
| Just press CTRL+F ( or select Edit\Find menu item ) and you have a dialog that will help you to locate the string that are you looking for. |
| The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link. |
| By default, the setup installs a chm file in your system folder. You can access the help file by pressing F1 key when in VB and the control is selected. You can also access the help file by typing ControlName.chm in the START menu RUN box. For instance, type excombobox.chm and the help file for ExComboBox component will be opened. |
By
default, the control contains no columns so at least one column
should be added before using it as in the following sample:
With ComboBox1
.BeginUpdate
.AutoComplete = False
.ColumnAutoResize = True
.Columns.Add "Default"
.EndUpdate
End With
The AutoComplete property specifies that the control does complete the control's label area based on the selected item. Setting this property on False, will let you type any character inside. |
Yes.
A prompt is a label or short instruction placed inside an editable
drop-down list as its default value. Unlike static text, prompts
disappear from the screen once users type something into the combo
box or it gets input focus. The Prompt
property of the column provides this functionality. The following
snippet of code displays a prompt for the control:
With ComboBox1
.BeginUpdate
.ColumnAutoResize = True
.AutoComplete = False
.Columns.Add("Default").Prompt = "<i><fgcolor=808080>prompt</fgcolor></i>"
.EndUpdate
End With
|
| That's nothing strange in that sample. The sample shows data hierarchical. When the component applies the filter it looks for all items that match the criteria and includes the parent items as well, else the filtered items will be hidden. You can comment the code that uses SetParent method to let control displays data as a simple list. |
| The CellTooltip property of Items object specifies the cell's tool tip. The cell's tool tip appears when the cursor is over the cell. If you set the CellTooltip ="..." ( three dots ), the control displays the cell's caption in a tool tip when it doesn't fit the cell's client area. |
|
The control provides a Columns property that helps you to add, remove or changes the columns of the control. By default, the control has no columns. The following code shows you how to add two columns to the control: With ComboBox1
.BeginUpdate
With .Columns
With .Add("Column 1")
.Width = 164
End With
With .Add("Column 2")
.HeaderImage = 1
End With
End With
.EndUpdate
End With
When many changes are made to the control , you should invoke the BeginUpdate
method to temporarily freeze the drawing of the control. This results in less
distraction to the user, and a performance gain. After all updates have been
made, invoke the EndUpdate method to resume drawing of the control. |
|
The control provides an Items property that helps you to add, remove or changes the items in the control. Before adding any new item to the control make sure that your control has at least one column. There are 4 methods to load items to the control.
Because control can load a list as well as a hierarchy each item is specified by a handle HITEM not by index. Each property that refers a cell requires a handle and an index to a column. By default, the control has no columns, so before adding new items you need to add columns like in the following sample
The following sample uses the first method to add few items to the Items collection. With ComboBox1.Items
Dim h As HITEM, hChild As HITEM
h = .AddItem("Group 1")
.CellCaption(h, 1) = "Information about Group 1"
hChild = .InsertItem(h, , "Child 1")
.CellCaption(hChild, 1) = "Information about Child 1"
hChild = .InsertItem(h, , "Child 2")
.CellCaption(hChild, 1) = "Information about Child 2"
h = .AddItem("Group 2")
.CellCaption(h, 1) = "Information about Group 2"
hChild = .InsertItem(h, , "Child 1")
.CellCaption(hChild, 1) = "Information about Child 1"
hChild = .InsertItem(h, , "Child 2")
.CellCaption(hChild, 1) = "Information about Child 2"
End With
When many changes are made to the control , you should invoke the BeginUpdate method to temporarily freeze the drawing of the control. This results in less distraction to the user, and a performance gain. After all updates have been made, invoke the EndUpdate method to resume drawing of the control. The following sample uses the VB Array function to insert items to a multiple columns control: Private Sub Form_Load()
With ComboBox1
.BeginUpdate
.Columns.Add "Column 1"
.Columns.Add "Column 2"
.Columns.Add "Column 3"
With .Items
Dim h As HITEM
h = .AddItem(Array("Item 1", "Item 2", "Item 3"))
.InsertItem h, , Array("Item 1.1", "Item 2.1", "Item 3.1")
.InsertItem h, , Array("Item 1.2", "Item 2.2", "Item 3.2")
.ExpandItem(h) = True
End With
.EndUpdate
End With
The following sample insert items to a multiple columns controls: Private Sub Form_Load()
With ComboBox1
.BeginUpdate
.Columns.Add "Column 1"
.Columns.Add "Column 2"
.Columns.Add "Column 3"
With .Items
Dim h As HITEM, h2 As HITEM
h = .AddItem("Item 1")
.CellCaption(h, 1) = "Item 2"
.CellCaption(h, 2) = "Item 3"
h2 = .InsertItem(h, , "Item 1.1")
.CellCaption(h2, 1) = "Item 1.2"
.CellCaption(h2, 2) = "Item 1.3"
h2 = .InsertItem(h, , "Item 2.1")
.CellCaption(h2, 1) = "Item 2.2"
.CellCaption(h2, 2) = "Item 2.3"
.ExpandItem(h) = True
End With
.EndUpdate
End With
|
| Once that you have the handle of the added item you have to sue the ItemPosition property to specify the item's position. |
|
The control provides a property ShowImageList that shows or hides that images list. By default, the property is True, to let new customers know that they can drag images without using an ImageList control. If you are going to add icons at runtime the control provides Images and ReplaceIcon methods. The Images method takes the handle to an ImageList control. The ReplaceIcon method works like follows:
|
| You can delete an icon from the images list window in design mode by selecting the icon and pressing the BackSpace key. You can delete the icon using the Delete key but some containers delete the object when Delete key is used. |
|
The control provides several options to select an item or a value. The Select and Value properties selects a value on a specified column. For instance, the following sample looks for an item that has in the column "Column 1" the "Child 2", and selects it, if the value is found: ComboBox1.Select(0) = "Child 2" or ComboBox1.Select("Column 1") = "Child 2"
Also, the Items object provides properties like: Items.SelectCount, Items.SelectItem, Items.SelectedItem that helps you to access the selected items. The control fires SelectionChanged event when user changes the selection. The following sample uses the FindItem method to looks for an item that contains in the column "Column 1" the value "Child 2" ComboBox1.Items.SelectItem(ComboBox1.Items.FindItem("Child 2", "Column 1")) = True
or ComboBox1.Items.SelectItem(ComboBox1.Items.FindItem("Child 2", 0)) = True
The following sample selects the first visible item: ComboBox1.Items.SelectItem(ComboBox1.Items.FirstVisibleItem) = TrueThe following sample displays the selected items. Only the caption on the first column are displayed. If you want to display more columns you have to change the 0 with index of column being displayed. With ComboBox1.Items
Dim i As Long
For i = 0 To .SelectCount - 1
Debug.Print .CellCaption(.SelectedItem(i), 0)
Next
End With
|
|
There Items object provides few methods like FindItem, FindPath in order to find an item. The FindItem method looks for the first item that has in a column the giving value. For instance the following sample gets the handle of the item that contains in the first column ( "Column 1" ) the value "Child 2": Debug.Print ComboBox1.Items.FindItem("Child 2", "Column 1")
If the FindItem method fails to locate the item the 0 is returned. If a non 0 value is returned that means that the control was able to locate the item. The FindPath method looks for a path in the control's hierarchy using the SearchColumnIndex property as being the searching column . The method requires the full path separated by the "/". Debug.Print ComboBox1.Items.FindPath("Group 2\Child 2")
Once that we have found the searched item all that we need to call EnsureVisibleItem method in order to ensure that the item is visible. If the item was a child of an item that was collapsed the EnsureVisibleItem method expands that item too. |
|
The control provides multiple ways to do that. If you only need to alternate the background color for items you should use the BackColorAlternate property. If only a particular item needs to be colorized, you have to use properties like: ItemForeColor, ItemBackColor, CellForeColor or CellBackColor. Remember that control fires the InsertItem event when a new item is inserted to the Items collection. You can use the InsertItem event to apply different colors for the newly added items and cells. |
|
The InsertItem event is called each time when a new item is inserted to the Items collection. We can use this event to color a column like in the following sample: Private Sub ComboBox1_InsertItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
With ComboBox1.Items
.CellBackColor(Item, 1) = vbRed
End With
End Sub
Another option that you have to color a column is if you are using the
CountLockedColumns property. The CountLockedColumn property specifies the number
of visible columns that are frozen on the left side. A frozen column is not
scrollable. The control provides in that case a property called BackColorLock
that specifies the background color for frozen area of the control. The same
thing is for ForeColorLock property except that it specifies the foreground
color for the frozen area. In case that CountLockedColumn > 0 the BackColor
and ForeColor properties are applicable to the scrollable area of the control. |
| The control provides a plenty of properties like: CellBold, CellItalic, CellUnderline, CellStrikeout, ItemBold, ItemStrikeout, and so on to help you set font attributes for a cell or for an item. As well as cells the column's header can have its own font attribute using the HeaderBold, HeaderItalic, and so on properties. Another alternative is using built-in HTML format. |
| The IntegralHeight property helps you to do that. If the control's Style property is DropDown or DropDownList the IntegralHeight property resizes the drop down window to avoid displaying partial items. The control uses the DefaultItemHeight , Items.ItemCount and the HeightList properties to to compute the size of the drop down window. If the AllowSizeGrip property is True, the end user can resizes the drop down window at runtime. If the IntegralHeight property is True no partial items are displayed. You can use AllowHResize and AllowVResize to allow user resizes only the width or the height of the control by dragging the control's size grip. |
|
By default, the control automatically sort a column when the user clicks the column's header. If the SortOnClick property is exNoSort the control doesn't sort the items when user clicks the column's header. There are two methods to get items sorted like follows:
|
|
Yes, you can. The following method uses a for each statement.. In the sample h variable specifies a handle to an item. With ComboBox1
Dim h As Variant
For Each h In .Items
Debug.Print .Items.CellCaption(h, 0)
Next
End With
The second method to iterate the items can be the following:
With ComboBox1 Dim i As Long For i = 0 To .Items.ItemCount - 1 Debug.Print .Items.CellCaption(.Items.ItemByIndex(i), 0) Next End With |
|
Yes. The following function displays all child items ( recursively ) Sub RecItem(ByVal c As EXCOMBOBOXLibCtl.ComboBox, ByVal h As HITEM)
If Not (h = 0) Then
Dim hChild As HITEM
With c.Items
Debug.Print .CellCaption(h, 0)
hChild = .ItemChild(h)
While Not (hChild = 0)
RecItem c, hChild
hChild = .NextSiblingItem(hChild)
Wend
End With
End If
end sub
|
|
The NotInList event occurs when the user enters a value in the text box portion of a combo box that isn't in the combo box list. The control doesn't fire this event if the FireNotInList property is False, so make sure that the property is set to True. The following sample shows how to add a new entry to the items list when NotInList event is fired: Private Sub ComboBox1_NotInList()
If MsgBox("Do you want to add it?", vbYesNo) = vbYes Then
With ComboBox1
Debug.Print .EditText(.SearchColumnIndex)
Dim h As HITEM
h = .Items.AddItem(.EditText(0))
.Items.CellCaption(h, 1) = .EditText(1)
.Items.SelectItem(h) = True
.Items.EnsureVisibleItem h
End With
End If
End Sub
|
| Yes, the control provides a property called SingleEdit. The SingleEdit property specifies whether the control's label display one or all visible columns in the control. If the SingleEdit property is True, the SearchColumnIndex property determines the column being displayed on the control's label. The control uses the TAB key to navigate through the visible columns. Actually when TAB key ( or SHIFT + TAB combination ) , the control changes the SearchColumnIndex property to point to next visible column. If you want to avoid changing the searching column you have to use the UseTabKey property. |
If TypeOf ComboBox1 Is EXCOMBOBOXLibCtl.ComboBox Then Debug.Print "ExComboBox" End If |
| The ColumnAutoResize property is what you are looking for. If the control's ColumnAutoResize property is True, the control arranges all visible columns to fit the control's client area. In this case no horizontal scroll bar is displayed. If the ColumnAutoResize property if False, control displays a horizontal scroll bar if the width of visible columns doesn't fit the width of the client area. |
|
To programmatically drop down the window you can use the following trick: Private Sub Command1_Click()
ComboBox1.SetFocus
SendKeys "{F4}"
End Sub
or the following ( it is recommended using this one ): Private Sub Command1_Click() ComboBox1.DropDown() = True End SubThe AutoDropDown property allows control to drop down automatically it's window when user start typing characters. |
| Yes. You need to implement a simple interface called IUnboundHandler. The setup program installs few samples about implementing the unbound handler. Using notification interface it's easy and quicker than using events. |
| All control properties that specifies a size or a coordinate are measured in pixels. Uses TwipsPerPixelX and TwipsPerPixelY properties to convert twips coordinates to pixel coordinates. The control's mouse events receive coordinates in twips, and they need to be converted if they are passed to one of the control's properties or methods. See ItemFromPoint method. |
| Yes. You can find UNICODE versions here. |
| Actually, the control does more than access2000 combobox does. You can see nice features in the control like: colors, font, pictures, hierarchy, filters and so on. |
|
Changing the Name property of the Font object doesn't notify the control that the used font has been changed, so calling ComboBox1.Font.Name = "Arial Unicode MS" has effect only for the control's drop-down window, but it doesn't change the font for control inside text editors. Remember that Font is a system object, and it is not implemented by the control, so that's the reason why the control is not notified that the user has changed the font's name. The following sample changes the font used by inside text editors as well for the drop-down window : Dim f As New StdFont
f.Name = "Arial Unicode MS"
ComboBox1.Font = f
|
|
You have to use the SelectItem property. If the control's Style is DropDown, you have to reset the text in the label using the EditText property. With ComboBox1.Items if .SelectCount > 0 then .SelectItem(.SelectedItem(0)) = False end if End With |
| Yes. please set the CloseOnDblClk property. The CloseOnDblClk property specifies whether the user closes the drop down window by dbl click. |
|
Yes. Place the control to your toolbar and then call: Private Sub Form_Load()
ComboBox1.Height = 128 * Screen.TwipsPerPixelY
End Sub
|
|
If you are going to resize the control at runtime, the HeightList property can be used to set the height of the dropdown window. The LabelHeight property helps you to specify the control's label height. You can resize the size of the drop down portion of the control at design time by doing the followings:
Another way to resize your control at design mode is:
If your control requires the size greater than the size of the form, you can resize the form, resize the control, and then resize back the form. |
| The control provides properties like CheckImage and RadioImage properties that help you to set your desired icons for check or radio buttons. |
|
When you expect performance you have to be carefully to each line of code in your project. Here's few hints about improving performance when you are using the control:
With ComboBox1.Columns
With .Add("Column 1")
.Width = 128
.AllowSizing = False
.AllowDragging = False
.DisplaySortIcon = False
End With
End With
or
With ComboBox1.Columns
Dim c As EXCOMBOBOXLibCtl.Column
Set c = .Add("Column 1")
c.Width = 128
c.AllowSizing = False
c.AllowDragging = False
c.DisplaySortIcon = False
End With
|
| The control's
Description property helps you to change descriptions used by
the control. For instance: the .Description( exFilterBarAll ) = "(Alle)"
changes the description for the first item in the drop down filter list, or the
Description( exFilterBarPatternTooltip ) = "Geben Sie hier das Muster nach dem Sie filtern wollen an. Als Platzhalter können *,? oder # benutzt werden. Zum Filtern drücken Sie ENTER Durch drücken der Strg Taste können Sie mehrere Begriffe aus der Liste selektieren und danach filtern
" changes the tooltip when the cursor is over the drop down list.
You can run the following code to see the identifiers for the control's descriptions that you might want to change: Private Sub Form_Load()
With ComboBox1
For i = 0 To 15
.Description(i) = i
Next
End With
End Sub
|
| Changes the UseMnemonic property to False. |
| The Items object provides properties like ItemDivider, ItemDividerLine helps you to merge cells of the row into a single cell. The setup installs a sample VB\Divider that helps you to understand how ItemDivider works. Also, the ItemDivider property helps you to group items in the control. The divider items are not scrolled when the user drags the horizontal scroll bar so the groups titles will be visible most of the time. The ItemDivider property specifies the index of cell being displayed instead displaying the entire item. |
|
The CellPicture property of the Items object helps you to attach a picture file ( bmp, gif, whatever ) to a cell. The following sample shows how to attach a picture to the first visible cell of the control: With ComboBox1.Items
.CellPicture(.FirstVisibleItem, 0) = LoadPicture("c:\winnt\Zapotec.bmp")
End With
or you can use the following way as well: Dim p As IPictureDisp
Set p = LoadPicture("c:\winnt\Zapotec.bmp")
With ComboBox1.Items
.CellPicture(.FirstVisibleItem, 0) = p
End With
If the picture's height is larger than item's height you can use the ItemHeight property to let picture fits the item's client area. The .CellPicture accepts objects of IPictureDisp type. The LoadPicture function retrieves an IPictureDisp object. |
The version 1.0.4.2 includes the built-in HTML format inside cells. The
CellCaptionFormat property specifies how the cell's caption ( CellCaption
property ) is displayed. If the CellCaptionFormat property is exText no HTML
formatting is applied. Else, if the CellCaptionFormat property is exHTML the
CellCaption is formatted using HTML tags. The list of valid tags are:
For instance: the HTML formatting "<b>Inbox</b> <fgcolor=0000FF>(78)</fgcolor>" draws the Inbox using bold font attributes, and (78) using the blue color, like: Inbox (78) |
| Usually, it's happen if the control's UseTabKey property is True. If the UseTabKey property is True, the control uses the TAB key to navigate through visible columns. If the UseTabKey is False, the control doesn't handle the TAB key, and so you will be able to move the focus to next control in the form, by pressing the TAB key. |
| You have to put ColumnAutoResize property on False. By default, the control's ColumnAutoResize property is True. If the ControlAutoResize is True, the sum of visible columns widths is equal with the width of the client area. |
| We recommend using #import directive to import the control's type library into your VC project. You don't need the control's TLB file. The dll file installed in your system folder exports the control's type library as well. For instance, the #import "c:\winnt\system32\excombobox.dll" imports the control's type library to your project. By default, the #import directive creates a namespace EXCOMBOBOXLib. |
|
The following snippet unselects the selected item:
|
| The control provides the ASCIILower and ASCIIUpper properties that helps you to specify the set of characters that are converted by the auto search feature. For instance if you have the set Ä/ä Ü/ü Ā/ā Ă/ă Ą/ą Ć/ć Ĉ/ĉ Ċ/ċ Č/č Ď/ď Ē/ē Ĕ/ĕ Ė/ė Ę/ę Ě/ě Ĝ/ĝ Ğ/ğ Ġ/ġ Ģ/ģ Ĥ/ĥ Ō/ō Ŏ/ŏ Ŕ/ŕ Ŗ/ŗ Ř/ř Ś/ś, you have to call something like: ASCIILower like "abcdefghijklmnopqrstuvwxyzäüā....", and ASCIIUpper like "ABCDEFGHIJKLMNOPQRSTUVWXYZÄÜA...." |
| The DEMO version disables the SelectionChanged event, SelectItem, SelectCount and SelectedItem properties. If you require a fully functional version please contact us. We will send you an updated version. |
|
The Data property of the column holds an extra data. The Data value is not used by the control, it is of Variant type, and it can be used to store extra values for your columns. I use your control into an ATL dialog and I cannot get GetDlgControl working as I expect. What do you suggest? |
| The EditText property gets the text in the edit control. If you have multiple columns the EditText( ColIndex ) gives the edit's text at the specified column. |
| The Key property of the Column object associates a key to a column. The Key and Caption properties are used by functions like Items.CellCaption, Items.CellBold, ... and so on. For instance, the CellCaption( hItem, "ABC" ) gets the cell's caption for the item hItem on the column that has the caption "ABC" or it has the key = "ABC". |
|
The CellImage property assign a single icon to the cell. Instead if multiple icons need to be assigned to a single cell you have to use the CellImages property. The CellImages property takes a list of additional icons and display them in the cell. The list is separated by ',' and should contain numbers that represent indexes to Images list collection. The following sample assign first and third icon to a cell:
|
|
Yes, the Exontrol ExPrint component ( exprint.dll ) provides Print and Print Preview capabilities for the exComboBox component. Once that you can have the exPrint component in your Components list, insert a new instance of "ExPrint 1.0 Control Library" to your form and add the following code:
The Exontrol Print Preview mainframe looks like follows:
|
|
The control provides the SortOnClick property that helps you to handle how the control sorts the columns when user clicks the column's header. The following sample shows how to sort a column using SortOrder property.
In this case if an user clicks a column, the column gets sorted like follows:
You can simulate the exDefaultSort by using the following handler:
|
|
You can use Items.ChildCount or Items.ItemChild property like follows: If (ComboBox1.Items.ChildCount(h) <> 0) Then End If or If (ComboBox1.Items.ItemChild(h) <> 0) Then End If The Items.ItemHasChildren property adds an expand button to the left side of the cell, no matter if the item contains child items. It is useful to build your virtual tree. |
| The Style property can be changed at runtime, starting with the version 1.0.5.7. If you are creating and removing the control dynamically and you need to set the appropriate Style property at runtime make sure that you are loading data after setting the Style property. The Style property clears the columns and items collections. |
|
The Key property replaces a virtual key that's used by the control. The following sample disables the PageUp and PageDown keys: ComboBox1.Key(vbKeyPageUp) = 0 ComboBox1.Key(vbKeyPageDown) = 0 The following sample shows how to open the drop down window when user hits the F2 key: ( by default, the control opens the drop down window if the user presses the F4 key ) ComboBox1.Key(vbKeyF4) = 0 ComboBox1.Key(vbKeyF2) = vbKeyF4 |
|
The EditText property has effect only if the control's Style property is DropDown or Simple. The following sample shows how to change the control's label.
|
|
The following sample shows how you can remove the selected item when user hits the Delete key:
|
|
Yes. The EditImage property assign an icon to the column's edit box. If the icon doesn't exist no icon is displayed. The AssignEditImageOnSelect property automatically assigns the icon for the column's edit when the selection is changed. |
The SortOrder
property of the Column
object specifies the column's sort order. The following function
retrieves the index of column that's sorted, or-1 if there is no sorted
column:
Private Function getSortingColumn(ByVal g As EXCOMBOBOXLibCtl.ComboBox) As Long
Dim c As EXCOMBOBOXLibCtl.Column
For Each c In g.Columns
If Not c.SortOrder = EXCOMBOBOXLibCtl.SortNone Then
getSortingColumn = c.Index
Exit Function
End If
Next
getSortingColumn = -1
End Function
|
| Yes. The control supports 'start with' and 'contains' incremental search feature. The AutoSearch property specifies whether the incremental search is supported. The AutoSearch property of the Column object defines the type of incremental searching. |
The
SearchColumnIndex
property resets the searching string, so you can use a sample like
follows:
Private Sub ComboBox1_LostFocus()
Dim i As Long
With ComboBox1
i = .SearchColumnIndex
.SearchColumnIndex = -1
.SearchColumnIndex = i
End With
End Sub
|
Call
the DropDown
property to show the drop down portion of the control. Use the
DropDown property to show the drop down portion of the control
when it gains the focus like in the following sample:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim p As POINTAPI
Private Sub ComboBox1_GotFocus()
ComboBox1.DropDown() = True
GetCursorPos p
SetCursorPos p.x - 16, p.y
End Sub
|
You
can use a code like follows:
Private Sub ComboBox1_DropDown()
ComboBox1.Key(vbKeyDown) = vbKeyDown
End Sub
Private Sub ComboBox1_DropUp()
ComboBox1.Key(vbKeyDown) = vbKeyF4
End Sub
Private Sub ComboBox1_GotFocus()
ComboBox1.Key(vbKeyDown) = vbKeyF4
End Sub
Thanks to Calvin Shields, who shared the note. |
| Starting with the version 2.0.0.6, the control provides the SelectableItem property. The SelectableItem property specifies whether an item is selectable. A not selectable item is not focusable item. Use the EnableItem property to enable or disable an item. |
| Yes. It is possible. The AdjustSearchColumn property specifies whether the SearchColumnIndex property could refer a hidden column. Use the SingleEdit property to display a single column in the control's label. So, you need to set the AdjustSearchColumn property on False, and to specify the index of column being displayed on the control's label using the SearchColumnIndex property. For instance, let's say that the drop down window contains some information and we need to display other information when selecting an item. You can do it by drawing your self the control's label, or you can have a hidden column with the information that should be displayed on the control's label. Another case, could be if you would like to display single line item in the control's label even if the drop down portion of the control contains items using multiple lines. |
|
The Click event is not fired when user the control's label, so you might want to check one of the following methods. If the Style property is DropDownList and the AutoDropDown property is True, the control shows the drop down portion of the control when user clicks the control's label area. The following samples use the DropDown method to programmatically show the drop down portion of the control. The following samples uses different methods to drop down the control when user clicks the control's label area. In order to run any of the following sample, please insert the control to a form/dialog, and apply its default template ( so we have loaded columns and items ). The following VB sample drops down the control when it receives the focus by clicking: The sample calls the DropDown method when the control gains the focus. The following VC sample shows the drop down portion of the control when the user clicks the control's label area ( WM_PARENTNOTIFY method ):
The OnParentNotify method handles the WM_PARENTNOTIFY message of the Dialog class. A parent's OnParentNotify member function is called by the framework when its child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. The m_combobox wraps the control, and it is a member of the dialog class. The sample calls the DropDown method only if the user clicks the control's label area. The following C# sample displays the drop down portion of the control when user clicks the control's label area:
The following VB.NET sample displays the drop down portion of the control when the user clicks the control's label area:
The following VFP sample displays the drop down message when the control gains the focus by clicking the control's label area:
|
| If the control has no columns, there is no edit control in the label area, so cursor can't show up. Use the Add method to insert new columns to the control. |
The component supports skinning parts of the control,
including the selected item. Please check the control's help
file for the Add method of the Appearance object. There you
will find almost everything you need to change the visual
appearance for most of the UI parts of the control. Shortly,
the idea is that identifier of the skin being added to the
Appearance collection is stored in the first significant
byte of property of the color type. In our case, we know
that the SelBackColor property changes the background color
for the selected item. This is what we need to change. In
other words, we need to
change the visual appearance for the selected item, and that
means changing the background color of the selected item.
So, the following code ( blue code ) changes the appearance
for the selected item:
With ComboBox1
.VisualAppearance.Add &H34, App.Path + "\aqua.ebn"
.SelBackColor = &H34000000
End With
Please notice that the 34 hexa value is arbitrary chosen, it is not a predefined value. Shortly, we have added a skin with the identifier 34, and we specified that the SelBackColor property should use that skin, in order to change the visual appearance for the selected item. Also, please notice that the 34 value is stored in the first significant byte, not in other position. For instance, the following sample doesn't use any skin when displaying the selected item: With ComboBox1
.VisualAppearance.Add &H34, App.Path + "\aqua.ebn"
.SelBackColor = &H34
End With
This code ( red code ) DOESN'T use any skin, because the 34 value is not stored in the higher byte of the color value. The sample just changes the background color for the selected item to some black color ( RGB(0,0,34 ) ). So, please pay attention when you want to use a skin and when to use a color. Simple, if you are calling &H34000000, you have 34 followed by 6 ( six ) zeros, and that means the first significant byte of the color expression. Now, back to the problem. The next step is how we are creating skins? or EBN files? The Exontrol's exbutton component includes a builder tool that saves skins to EBN files. So, if you want to create new skin files, you need to download and install the exbutton component from our web site. Once that the exbutton component is installed, please follow the steps. Let's say that we have a BMP file, that we want to stretch on the selected item's background.
You can always open the skin with the builder and change it later, in case you want to change it. Now, create a new project, and insert the component where you want to use the skin, and add the skin file to the Appearance collection of the object, using blue code, by changing the name of the file or the path where you have selected the skin. Once that you have added the skin file to the Appearance collection, you can change the visual appearance for parts of the controls that supports skinning. Usually the properties that changes the background color for a part of the control supports skinning as well. |
| Use the ShowToolTip method and AnchorFromPoint property to display a tooltip when user hovers an anchor element. |
There are several options in order to display a different content for the
column. By default, the Items.CellCaption property indicates the value being shown
in the cell.
|