The Ring Programming Language Version 1.5 Book - Part 57 of 180
The Ring Programming Language Version 1.5 Book - Part 57 of 180
Another Example:
Load "guilib.ring"
New qApp {
setGeometry(100,100,500,400)
setcurrentrow(3,2)
win1.setwindowtitle("Items Count : " + count() )
}
show()
}
exec()
}
func pWork
nbrOfItems = list1.count()
curItemNbr = list1.currentrow()
curValue = list1.item(list1.currentrow()).text()
func pWork2
list1 {
takeitem(currentrow())
nbrOfItems = count()
curItemNbr = currentrow()
curValue = item(currentrow()).text()
In this example we will learn how to use the QTreeView widget to represent the File System
Load "guilib.ring"
New qApp {
New qtreeview(win1) {
setGeometry(00,00,500,400)
oDir = new QDir()
ofile = new QFileSystemModel()
ofile.setrootpath(oDir.currentpath())
setmodel(ofile)
}
show()
}
exec()
}
In this example we will learn about using the QTreeWidget and QTreeWidgetItem classes
Load "guilib.ring"
New qApp {
setwindowtitle("TreeWidget")
setGeometry(100,100,400,400)
for y = 1 to 10
myitem3 = new qtreewidgetitem()
myitem3.settext(0,"hello"+x)
myitem2.addchild(myitem3)
next
next
setheaderlabel("Steps Tree")
}
layout1.addwidget(tree1)
setlayout(layout1)
show()
}
exec()
}
Load "guilib.ring"
New qApp {
setwindowtitle("Using QComboBox")
setGeometry(100,100,400,400)
New QComboBox(win1) {
setGeometry(150,100,200,30)
alist = ["one","two","three","four","five"]
for x in aList additem(x,0) next
}
show()
}
exec()
}
Load "guilib.ring"
setwindowtitle("Using QMenubar")
setGeometry(100,100,400,400)
settext("Reference")
}
addaction(oAction)
sub4 = addmenu("Sub Menu")
sub4 {
oAction = new qAction(win1) {
settext("Website")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Forum")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Blog")
}
addaction(oAction)
}
addseparator()
oAction = new qAction(win1) {
settext("About")
}
addaction(oAction)
}
}
show()
}
exec()
}
New qApp {
setwindowtitle("Using QToolbar")
setGeometry(100,100,600,400)
abtns = [
new qpushbutton(win1) { settext("Add") } ,
new qpushbutton(win1) { settext("Edit") } ,
new qpushbutton(win1) { settext("Find") } ,
new qpushbutton(win1) { settext("Delete") } ,
new qpushbutton(win1) { settext("Exit")
setclickevent("win1.close()") }
]
setFloatable(true)
}
show()
}
exec()
}
New qApp {
setwindowtitle("Using QStatusbar")
setGeometry(100,100,400,400)
setstatusbar(status1)
show()
}
exec()
}
New qApp {
setwindowtitle("QDockWidget")
setGeometry(100,100,400,400)