Beruflich Dokumente
Kultur Dokumente
56.55. Classes and their Methods to use the default events 625
Ring Documentation, Release 1.5
56.55. Classes and their Methods to use the default events 626
Ring Documentation, Release 1.5
RingQt define a new class called QAllEvents that help you in using Events Filter
The next table presents the methods that we have
Methods to get parameters Class Name
getKeyCode() > Number QAllEvents
getx() > Number
gety() > Number
getglobalx() > Number
getglobaly() > Number
getbutton() > Number
getbuttons() > Number
The next table presents the methods that we have to use events.
1. RingQt use simple methods to set the code that will be executed for events.
Syntax:
Set<Event_Name>Event(cEventCode)
2. RingQt change the name of some methods to avoid conflict with Ring Keywords.
The next table present these little changes
Qt Documentation : http://doc.qt.io/qt-5/classes.html
See the RingQt Classes and Methods Reference chapter for supported classes and methods.
We added new classes to RingQt - another version of classes where the class names doesnt start with the q letter
Also updated methods so the index start from 1 when we deal with the GUI controls like
ComboBox
ListWidget
TableWidget
TreeWidget
These classes are inside guilib.ring under the package name : System.GUI
To use it
load "guilib.ring"
import System.GUI
This doesnt have any effect on our previous code, Its just another choice for better code that is consistent with Ring
rules.
Also the form designer is updated to provide us the choice between using classes where (index start from 0) or (index
start from 1)
Example (Uses the Form Designer)
1. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/indexstart/indexstartView.ring
2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/indexstart/indexstartController.ring
import System.Web
import System.GUI
new qApp {
open_window(:CustomersReportController)
exec()
}
class CustomersReportController
func Start
CreateReport()
func CreateReport
mypage = new HtmlPage {
h1 { text("Customers Report") }
Table
{
style = stylewidth("100%") + stylegradient(4)
TR
{
TD { WIDTH="10%"
text("Customers Count : " ) }
TD { text (100) }
}
}
Table
{
style = stylewidth("100%") + stylegradient(26)
TR
{
style = stylewidth("100%") +
stylegradient(24)
TD { text("Name " ) }
TD { text("Age" ) }
TD { text("Country" ) }
TD { text("Job" ) }
TD { text("Company" ) }
}
for x = 1 to 100
TR
{
TD { text("Test" ) }
TD { text("30" ) }
TD { text("Egypt" ) }
56.60. Creating Reports using the WebLib and the GUILib 630
Ring Documentation, Release 1.5
TD { text("Sales" ) }
TD { text("Future" ) }
}
next
}
}
write("report.html",mypage.output())
func PrintEvent
printer1 = new qPrinter(0) {
setoutputformat(1)
setoutputfilename("report.pdf")
}
oView {
web.print(printer1)
web.show()
}
system ("report.pdf")
class CustomersReportView
Screen Shot:
56.60. Creating Reports using the WebLib and the GUILib 631
Ring Documentation, Release 1.5
56.60. Creating Reports using the WebLib and the GUILib 632
CHAPTER
FIFTYSEVEN
In this chapter we will learn about Building RingQt Applications for Mobile.
Update the Android SDK to get the API and tools packages required for development
633
Ring Documentation, Release 1.5
Note: All of the missing libraries ((LibCurl, OpenSSL & Allegro) can be compiled for Android, but they are not
included in this Qt project.
3. use if isandroid() when you want to modify the code just for android