SlideShare a Scribd company logo
Ring Documentation, Release 1.3
btn1 = new qpushbutton(win1) {
setGeometry(10,200,100,30)
settext("selected item")
setclickevent("pWork()")
}
btn2 = new qpushbutton(win1) {
setGeometry(10,240,100,30)
settext("Delete item")
setclickevent("pWork2()")
}
show()
}
exec()
}
func pWork
btn1.settext(string(list1.currentrow()))
func pWork2
list1 {
takeitem(currentrow())
}
The application during the runtime
49.4. Using the QListWidget Class 408
Ring Documentation, Release 1.3
Another Example:
Load "guilib.ring"
New qApp {
win1 = new qWidget() {
setGeometry(100,100,500,400)
list1 = new qlistwidget(win1) {
setGeometry(150,100,200,200)
alist = ["one","two","three","four","five"]
for x in alist additem(x) next
setcurrentrow(3,2)
win1.setwindowtitle("Items Count : " + count() )
}
btn1 = new qpushbutton(win1) {
setGeometry(10,200,100,30)
settext("selected item")
setclickevent("pWork()")
}
btn2 = new qpushbutton(win1) {
setGeometry(10,240,100,30)
settext("Delete item")
setclickevent("pWork2()")
}
show()
}
exec()
}
func pWork
nbrOfItems = list1.count()
curItemNbr = list1.currentrow()
curValue = list1.item(list1.currentrow()).text()
win1.setwindowtitle( "After Select - NbrOfItems: " + nbrOfItems +
" CurItemNbr: " + curItemNbr + " CurValue: " + curValue )
btn1.settext( string(list1.currentrow() ) + " --- " +
list1.item(list1.currentrow()).text() )
func pWork2
list1 {
takeitem(currentrow())
nbrOfItems = count()
curItemNbr = currentrow()
curValue = item(currentrow()).text()
49.4. Using the QListWidget Class 409
Ring Documentation, Release 1.3
win1.setwindowtitle("After Delete - NbrOfItems: " + nbrOfItems +
" CurItemNbr: " + curItemNbr +" CurValue: " + curValue )
}
49.5 Using QTreeView and QFileSystemModel
In this example we will learn how to use the QTreeView widget to represent the File System
Load "guilib.ring"
New qApp {
win1 = New qWidget() {
setwindowtitle("Using QTreeView and QFileSystemModel")
setGeometry(100,100,500,400)
New qtreeview(win1) {
setGeometry(00,00,500,400)
oDir = new QDir()
ofile = new QFileSystemModel()
ofile.setrootpath(oDir.currentpath())
setmodel(ofile)
}
show()
}
exec()
}
The application during the runtime
49.5. Using QTreeView and QFileSystemModel 410
Ring Documentation, Release 1.3
49.6 Using QTreeWidget and QTreeWidgetItem
In this example we will learn about using the QTreeWidget and QTreeWidgetItem classes
Load "guilib.ring"
New qApp {
win1 = new qWidget() {
setwindowtitle("TreeWidget")
setGeometry(100,100,400,400)
layout1 = new qvboxlayout()
tree1 = new qtreewidget(win1) {
setGeometry(00,00,400,400)
setcolumncount(1)
myitem = new qtreewidgetitem()
myitem.settext(0,"The First Step")
addtoplevelitem(myitem)
for x = 1 to 10
myitem2 = new qtreewidgetitem()
myitem2.settext(0,"hello"+x)
myitem.addchild(myitem2)
49.6. Using QTreeWidget and QTreeWidgetItem 411
Ring Documentation, Release 1.3
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()
}
The application during the runtime
49.7 Using QComboBox Class
In this example we will learn about using the QComboBox class
49.7. Using QComboBox Class 412
Ring Documentation, Release 1.3
Load "guilib.ring"
New qApp {
win1 = new qWidget() {
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()
}
The application during the runtime
49.8 Creating Menubar
In this example we will learn about using the QMenuBar class
49.8. Creating Menubar 413
Ring Documentation, Release 1.3
Load "guilib.ring"
MyApp = New qApp {
win1 = new qWidget() {
setwindowtitle("Using QMenubar")
setGeometry(100,100,400,400)
menu1 = new qmenubar(win1) {
sub1 = addmenu("File")
sub2 = addmenu("Edit")
sub3 = addmenu("Help")
sub1 {
oAction = new qAction(win1) {
settext("New")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Open")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Save")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Save As")
}
addaction(oAction)
addseparator()
oAction = new qaction(win1) {
settext("Exit")
setclickevent("myapp.quit()")
}
addaction(oAction)
}
sub2 {
oAction = new qAction(win1) {
settext("Cut")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Copy")
}
addaction(oAction)
oAction = new qAction(win1) {
settext("Paste")
}
addaction(oAction)
addseparator()
oAction = new qAction(win1) {
settext("Select All")
}
addaction(oAction)
}
sub3 {
oAction = new qAction(win1) {
49.8. Creating Menubar 414
Ring Documentation, Release 1.3
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()
}
The application during the runtime
49.8. Creating Menubar 415
Ring Documentation, Release 1.3
49.9 Creating Toolbar
In this example we will learn about using the QToolBar class
Load "guilib.ring"
New qApp {
win1 = new qMainWindow() {
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()") }
]
tool1 = new qtoolbar(win1) {
for x in abtns addwidget(x) addseparator() next
setmovable(true)
setGeometry(0,0,500,30)
49.9. Creating Toolbar 416
Ring Documentation, Release 1.3
setFloatable(true)
}
show()
}
exec()
}
The application during the runtime
49.10 Creating StatusBar
In this example we will learn about using the QStatusBar class
Load "guilib.ring"
New qApp {
win1 = new qMainWindow() {
setwindowtitle("Using QStatusbar")
setGeometry(100,100,400,400)
status1 = new qstatusbar(win1) {
showmessage("Ready!",0)
49.10. Creating StatusBar 417

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.2 book - Part 48 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 47 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 66 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 49 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 73 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 45 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 65 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 45 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 68 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 67 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 71 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 46 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 67 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 69 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 71 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 76 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 63 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 66 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 57 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 47 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 48 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 47 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 66 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 49 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 73 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 45 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 65 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 45 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 68 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 67 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 71 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 46 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 67 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 69 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 71 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 76 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 63 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 66 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 57 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 47 of 88
Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.3 book - Part 44 of 88 (18)

PDF
The Ring programming language version 1.4.1 book - Part 17 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 70 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 58 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 43 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 68 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 59 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 76 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 74 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 16 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 64 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 77 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 18 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 63 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 76 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 44 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 72 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 62 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 60 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 17 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 70 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 58 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 43 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 68 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 59 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 76 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 74 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 16 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 64 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 77 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 18 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 63 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 76 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 44 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 72 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 62 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 60 of 181
Mahmoud Samir Fayed
 
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
Ad

Recently uploaded (20)

PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Python basic programing language for automation
DanialHabibi2
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 

The Ring programming language version 1.3 book - Part 44 of 88

  • 1. Ring Documentation, Release 1.3 btn1 = new qpushbutton(win1) { setGeometry(10,200,100,30) settext("selected item") setclickevent("pWork()") } btn2 = new qpushbutton(win1) { setGeometry(10,240,100,30) settext("Delete item") setclickevent("pWork2()") } show() } exec() } func pWork btn1.settext(string(list1.currentrow())) func pWork2 list1 { takeitem(currentrow()) } The application during the runtime 49.4. Using the QListWidget Class 408
  • 2. Ring Documentation, Release 1.3 Another Example: Load "guilib.ring" New qApp { win1 = new qWidget() { setGeometry(100,100,500,400) list1 = new qlistwidget(win1) { setGeometry(150,100,200,200) alist = ["one","two","three","four","five"] for x in alist additem(x) next setcurrentrow(3,2) win1.setwindowtitle("Items Count : " + count() ) } btn1 = new qpushbutton(win1) { setGeometry(10,200,100,30) settext("selected item") setclickevent("pWork()") } btn2 = new qpushbutton(win1) { setGeometry(10,240,100,30) settext("Delete item") setclickevent("pWork2()") } show() } exec() } func pWork nbrOfItems = list1.count() curItemNbr = list1.currentrow() curValue = list1.item(list1.currentrow()).text() win1.setwindowtitle( "After Select - NbrOfItems: " + nbrOfItems + " CurItemNbr: " + curItemNbr + " CurValue: " + curValue ) btn1.settext( string(list1.currentrow() ) + " --- " + list1.item(list1.currentrow()).text() ) func pWork2 list1 { takeitem(currentrow()) nbrOfItems = count() curItemNbr = currentrow() curValue = item(currentrow()).text() 49.4. Using the QListWidget Class 409
  • 3. Ring Documentation, Release 1.3 win1.setwindowtitle("After Delete - NbrOfItems: " + nbrOfItems + " CurItemNbr: " + curItemNbr +" CurValue: " + curValue ) } 49.5 Using QTreeView and QFileSystemModel In this example we will learn how to use the QTreeView widget to represent the File System Load "guilib.ring" New qApp { win1 = New qWidget() { setwindowtitle("Using QTreeView and QFileSystemModel") setGeometry(100,100,500,400) New qtreeview(win1) { setGeometry(00,00,500,400) oDir = new QDir() ofile = new QFileSystemModel() ofile.setrootpath(oDir.currentpath()) setmodel(ofile) } show() } exec() } The application during the runtime 49.5. Using QTreeView and QFileSystemModel 410
  • 4. Ring Documentation, Release 1.3 49.6 Using QTreeWidget and QTreeWidgetItem In this example we will learn about using the QTreeWidget and QTreeWidgetItem classes Load "guilib.ring" New qApp { win1 = new qWidget() { setwindowtitle("TreeWidget") setGeometry(100,100,400,400) layout1 = new qvboxlayout() tree1 = new qtreewidget(win1) { setGeometry(00,00,400,400) setcolumncount(1) myitem = new qtreewidgetitem() myitem.settext(0,"The First Step") addtoplevelitem(myitem) for x = 1 to 10 myitem2 = new qtreewidgetitem() myitem2.settext(0,"hello"+x) myitem.addchild(myitem2) 49.6. Using QTreeWidget and QTreeWidgetItem 411
  • 5. Ring Documentation, Release 1.3 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() } The application during the runtime 49.7 Using QComboBox Class In this example we will learn about using the QComboBox class 49.7. Using QComboBox Class 412
  • 6. Ring Documentation, Release 1.3 Load "guilib.ring" New qApp { win1 = new qWidget() { 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() } The application during the runtime 49.8 Creating Menubar In this example we will learn about using the QMenuBar class 49.8. Creating Menubar 413
  • 7. Ring Documentation, Release 1.3 Load "guilib.ring" MyApp = New qApp { win1 = new qWidget() { setwindowtitle("Using QMenubar") setGeometry(100,100,400,400) menu1 = new qmenubar(win1) { sub1 = addmenu("File") sub2 = addmenu("Edit") sub3 = addmenu("Help") sub1 { oAction = new qAction(win1) { settext("New") } addaction(oAction) oAction = new qAction(win1) { settext("Open") } addaction(oAction) oAction = new qAction(win1) { settext("Save") } addaction(oAction) oAction = new qAction(win1) { settext("Save As") } addaction(oAction) addseparator() oAction = new qaction(win1) { settext("Exit") setclickevent("myapp.quit()") } addaction(oAction) } sub2 { oAction = new qAction(win1) { settext("Cut") } addaction(oAction) oAction = new qAction(win1) { settext("Copy") } addaction(oAction) oAction = new qAction(win1) { settext("Paste") } addaction(oAction) addseparator() oAction = new qAction(win1) { settext("Select All") } addaction(oAction) } sub3 { oAction = new qAction(win1) { 49.8. Creating Menubar 414
  • 8. Ring Documentation, Release 1.3 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() } The application during the runtime 49.8. Creating Menubar 415
  • 9. Ring Documentation, Release 1.3 49.9 Creating Toolbar In this example we will learn about using the QToolBar class Load "guilib.ring" New qApp { win1 = new qMainWindow() { 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()") } ] tool1 = new qtoolbar(win1) { for x in abtns addwidget(x) addseparator() next setmovable(true) setGeometry(0,0,500,30) 49.9. Creating Toolbar 416
  • 10. Ring Documentation, Release 1.3 setFloatable(true) } show() } exec() } The application during the runtime 49.10 Creating StatusBar In this example we will learn about using the QStatusBar class Load "guilib.ring" New qApp { win1 = new qMainWindow() { setwindowtitle("Using QStatusbar") setGeometry(100,100,400,400) status1 = new qstatusbar(win1) { showmessage("Ready!",0) 49.10. Creating StatusBar 417