User Tools

Site Tools


combobox

ComboBox (QComboBox)

www.kbasic.com_images_combobox.jpg

The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.3/qcombobox.html

A control for the form object, is a combined button and popup list.

A combobox is a selection control which displays the current item and can pop up a list of items. Comboboxes provide a means of showing the user’s current choice out of a list of options in a way that takes up the minimum amount of screen space.

Whenever you use Index, KBasic checks if Index is greater equal 1 and smaller equal Length(). If not, the command will not be executed, e.g. You use Insert(10, “test”), but there are only 4 elements yet, the Insert will fail. First element has got Index = 1.

Most important

Methods Find
Properties Value
Events OnEvent

Please read the control class overview Control as well.

METHODS

Length

Function Length() As Integer


Find

Function Find(Caption As String) As Integer

Searches all items and return the index.

The first entry has got index = 1.

Returns 0 if item could not be found.

The search is case-sensitive means that it must exactly match the search string.


HidePopUp

Sub HidePopUp()


ShowPopUp

Sub ShowPopUp()


Insert

Sub Insert(Index As Integer, Caption As String)

The first entry has got index = 1.


Insert

Sub Insert(Index As Integer, Icon As String, Caption As String)

The first entry has got index = 1.


InsertSeparator

Sub InsertSeparator(Index As Integer)

Implemented since KBasic V1.83

The first entry has got index = 1.


Append

Sub Append(Caption As String)


Append

Sub Append(Icon As String, Caption As String)

Might be a String containing binary data. See the binary project example for using.


AppendSeparator

Sub InsertSeparator()

Implemented since KBasic V1.83


Remove

Sub Remove(Index As Integer)

The first entry has got index = 1.


RemoveAll

Sub RemoveAll()


Select

Sub Select(Index As Integer)

The first entry has got index = 1.


Select

Sub Select(Caption As String)

The search is case-sensitive means that it must exactly match the search string.


Selected

Function Selected() As Integer

The first entry has got index = 1.


Caption

Function Caption() As String


Index

Function Index() As Integer


Data

Function Data() As Integer


Caption

Function Caption(Index As Integer) As String


SetCaption

Sub SetCaption(Index As Integer, Caption As String)


SetIcon

Sub SetIcon(Index As Integer, Icon As String)


Tag

Function Tag(Index As Integer) As String


SetTag

Sub SetTag(Index As Integer, Tag As String)


not implemented yet:

findData int findText ( const QString & text, Qt::MatchFlags flags = Qt::MatchExactly | Qt::MatchCaseSensitive ) const insert(integer, strings) append(strings) insertSeparator ( int index ) void setItemData ( int index, const QVariant & value, int role = Qt::UserRole ) void setLineEdit ( QLineEdit * edit ) → textbox void QComboBox::setView ( QAbstractItemView * itemView ) → TreeView, ListView?? →FormsView

PROPERTIES

Value

Property Value As String (ReadWrite)

Set the current selected item.

The search is case-sensitive means that it must exactly match the search string.


OldValue

Property OldValue As String (ReadOnly)

Contains the previous selected item.


Text

Property Text As String (ReadWrite)

Same as Value. Provided for easy-use.


DoubleEntry

Property DoubleEntry As Boolean (ReadWrite)

If it is true, it is possible to have entries with the same caption many times in the combobox list.


InsertPolicy

Property InsertPolicy As String (ReadWrite)

This property holds the policy used to determine where user-inserted items should appear in the combobox.

Possible values are

  • NoInsert
  • InsertAtTop
  • InsertAtCurrent
  • InsertAtBottom
  • InsertAfterCurrent
  • InsertBeforeCurrent
  • InsertAlphabetically

Editable

Property Editable As Boolean (ReadWrite)

It it is true, it is possible for the user to select or enter by keyboard.


Maximum

Property Maximum As Integer (ReadWrite)

How many entries are allowed.


MaximumVisible

Property MaximumVisible As Integer (ReadWrite)

How many items are visible at one time, means how long is the list you can see in the popup.

Depends on the GUI style set (e.g. Windows Style, GTK Style…) and may be ignored.


Flat

Property Flat As Boolean (ReadWrite)

If it is true, appears as flat control. This is only useful to change the visual appearance.


not implemented yet: SizeAdjustPolicy minimumContentsLength iconwidth iconheight completer ValidatorRegExp

EVENTS

OnEvent

Sub OnEvent(Index As Integer, Caption As String)

This event is raised, when the user selects a new item.

The first item has got index = 1.


combobox.txt · Last modified: 2013/06/04 13:55 by berndnoetscher