User Tools

Site Tools


listbox

ListBox (QListWidget)

www.kbasic.com_images_listbox.jpg

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

A control for the form object, provides a list of selectable, read-only items.

This is typically a single-column list in which either no item or one item is selected, but it can also be used in many other ways.

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

Properties Value
Events OnEvent

Please read the control class overview Control as well.

METHODS

Length

Function Length () As Integer


Sort

Sub Sort(Descending As Boolean)


Insert

Sub Insert(Index As Integer, Caption As String)


Insert

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


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.


Remove

Sub Remove(Index As Integer)

Index = 1 means the first entry

Index = 2 means the second entry and so on


RemoveAll

Sub RemoveAll()


Select

Sub Select(Index As Integer)


Select

Sub Select(Caption As String)

Searches case-sensitive.


Selected

Function Selected() As Integer


Caption

Function Caption() As String


Index

Function Index() As Integer


Data

Function Data() As Integer


Caption

Function Caption(Index As Integer) As Integer


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 Integer


SetTag

Sub SetTag(Index As Integer, Tag As String)


CheckState

Function CheckState(Index As Integer) As String


SetCheckState

Sub SetCheckState(Index As Integer, CheckState As String)

Possible ValueDescription
UncheckedThe item is unchecked.
PartiallyCheckedThe item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.
CheckedThe item is checked.

Flag

Function Flag(Index As Integer) As String

NoItemFlags It does not have any properties set.
ItemIsSelectable It can be selected.
ItemIsEditable It can be edited.
ItemIsDragEnabled It can be dragged.
ItemIsDropEnabled It can be used as a drop target.
ItemIsUserCheckable It can be checked or unchecked by the user.
ItemIsEnabled The user can interact with the item.
ItemIsTristate

SetFlag

Sub SetFlag(Index As Integer, Flag As String)


SetBackground

Sub SetBackground(Index As Integer, ColorId As String)


SetBackground

Sub SetBackground(Index As Integer, ColorId As String, BrushStyle As String)

Possible values for BrushStyle are:

NoBrush, SolidPattern, Dense1Pattern, Dense2Pattern, Dense3Pattern, Dense4Pattern, Dense5Pattern, Dense6Pattern, Dense7Pattern, HorPattern, VerPattern, CrossPattern, BDiagPattern, FDiagPattern, DiagCrossPattern, LinearGradientPattern, ConicalGradientPattern, RadialGradientPattern, TexturePattern


IsHidden

Function IsHidden(Index As Integer) As Boolean


SetHidden

Sub SetHidden(Index As Integer, IsHidden As Boolean)


IsSelected

Function IsSelected(Index As Integer) As Boolean


SetSelected

Sub SetSelected(Index As Integer, IsSelected As Boolean)


StatusTip

Function StatusTip(Index As Integer) As String


SetStatusTip

Sub SetStatusTip(Index As Integer, StatusTip As String)


ToolTip

Function ToolTip(Index As Integer) As String


SetToolTip

Sub SetToolTip(Index As Integer, ToolTip As String)


TextAlignment

Function TextAlignment(Index As Integer) As String


SetTextAlignment

Sub SetTextAlignment(Index As Integer, TextAlignment As String)

Possible ValueDescription (Qt documentation says)
AlignLeftAligns with the left edge.
AlignRightAligns with the right edge.
AlignHCenterCenters horizontally in the available space.
AlignJustifyJustifies the text in the available space.
AlignTopAligns with the top.
AlignBottomAligns with the bottom.
AlignVCenterCenters vertically in the available space.
AlignCenterCenters in both dimensions.
AlignAbsoluteIf the widget's layout direction is RightToLeft (instead of LeftToRight, the default), AlignLeft refers to the right edge and AlignRight to the left edge. This is normally the desired behavior. If you want AlignLeft to always mean “left” and AlignRight to always mean “right”, combine the flag with AlignAbsolute.
AlignLeadingSynonym for AlignLeft.
AlignTrailingSynonym for AlignRight.
AlignHorizontal_MaskAlignLeft Or AlignRight Or AlignHCenter Or AlignJustify Or AlignAbsolute
AlignVertical_MaskAlignTop Or AlignBottom Or AlignVCenter

not implemented yet: append(strings) insert(integer, strings)

void openEditor ( integer ) closeEditor

# QList<QListWidgetItem *> findItems ( const QString & text, Qt::MatchFlags flags ) const → Integers # # QList<QListWidgetItem *> selectedItems () const → Integers #

# void setCurrentItem ( QListWidgetItem * item, QItemSelectionModel::SelectionFlags command ) #

void ScrollTo(Integer)

setWhatsThis/WhatsThis

SetFontColor

PROPERTIES

Value

Property Value As String (ReadWrite)


OldValue

Property OldValue As String (ReadOnly)


Text

Property Text As String (ReadWrite)

Same as Value. Provided for easy-use.


Sorted

Property Sorted As Boolean (ReadWrite)

This property holds whether sorting is enabled.


SelectionMode

Property SelectionMode As String (ReadWrite)


AlternatingRowColors

Property AlternatingRowColors As Boolean (ReadWrite)


Flat

Property Flat As Boolean (ReadWrite)

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


ViewMode

Implemented since KBasic V1.8.

Property ViewMode As String (ReadWrite)

Possible values are ListMode or IconMode.


not implemented yet:

IconWidth/height(QSize(96, 84)); Movement(QListView::Static); Spacing(12);

Orientation

EVENTS

OnEvent

Sub OnEvent(Index As Integer, Caption As String)

This event is raised, when the user changes the selection.


not implemented yet:

void currentItemChanged ( QListWidgetItem * current, QListWidgetItem * previous )

void currentRowChanged ( int currentRow )

void currentTextChanged ( const QString & currentText )

void itemActivated ( QListWidgetItem * item )

void itemChanged ( QListWidgetItem * item )

void itemClicked ( QListWidgetItem * item )

void itemDoubleClicked ( QListWidgetItem * item )

void itemEntered ( QListWidgetItem * item )

void itemPressed ( QListWidgetItem * item )

void itemSelectionChanged ()

Model Baju Batik Kantor Model Baju Batik 2013 Model Baju Batik Model Baju Batik Pria Model Baju Batik Wanita Model Baju Batik Modern Baju Batik Kerja Dokar Balap Berita Hari Ini Berita Terupdate Kumpulan Berita Baju Batik Sarimbit Baju Batik Terbaru Baju Batik Couple Baju Batik Pasangan Baju Batik Wanita Baju Batik Pria Baju Batik Modern Baju Batik Berita Terkini Berita Terbaru

listbox.txt · Last modified: 2013/05/15 22:13 by 202.152.204.214