SlideShare a Scribd company logo
Ring Documentation, Release 1.9
5.5 StopWatch Application
Ring 1.8 comes with StopWatch application
5.5. StopWatch Application 59
Ring Documentation, Release 1.9
5.6 More 3D Samples
Ring 1.8 comes with more 3D Samples
The next screen shot for the Top-Down view - Many levels of cubes sample
5.6. More 3D Samples 60
Ring Documentation, Release 1.9
The next screen shot for the Camera Sample
The next screen shot for the Camera and background sample
Developer : Azzeddine Remmal
5.6. More 3D Samples 61
Ring Documentation, Release 1.9
5.7 Compiling on Manjaro Linux
Ring 1.8 is tested on Manjaro Linux too
Tests by : Iip Rifai
5.7. Compiling on Manjaro Linux 62
Ring Documentation, Release 1.9
5.8 Using This in the class region as Self
The class region is the region that comes after the class name and before any method.
Now we can use This in the class region as Self.
Example:
func main
o1 = new program {
test()
}
? o1
class program
this.name = "My Application"
this.version = "1.0"
? name ? version
func test
? "Name = " + name
? "Version = " + version
Output
My Application
1.0
Name = My Application
Version = 1.0
name: My Application
version: 1.0
Note: When we use braces to change the current active object, Using This we can still point to the class.
Tip: The difference between This and Self is that Self point to the current active object that we can change using
braces.
Remember that in most cases we don’t need to use This or Self in the class region
We can write
class program name version
Or
class program name="My Application" version="1.0"
Note: We use This or Self in the class region just to avoid conflict with global variables that are defined with the same
name.
5.8. Using This in the class region as Self 63
Ring Documentation, Release 1.9
5.9 Default value for object attributes is NULL
Starting from Ring 1.8 the default value for object attributes is NULL
In Ring, the NULL value is just an empty string or a string that contains “NULL”
We can check for NULL values using the isNULL() function
Example:
oProgram = new Program
? oProgram.name
? oProgram.version
? isNULL(oProgram.name)
? isNULL(oProgram.version)
oProgram { name="My Application" version="1.0" }
? isNULL(oProgram.name)
? isNULL(oProgram.version)
? oProgram
class program
name
version
Output:
NULL
NULL
1
1
0
0
name: My Application
version: 1.0
In previous versions of Ring, trying to access the object attribute before assigning a value to it
Will lead to runtime error and you can’t check it using isnull()
The only way was assigning a value or using try/catch/end
We changed this behavior so we can have full control in seamless way.
5.10 The For Loops uses the local scope
In Ring 1.8, when the For Loop defines new identifier (variable) it will define it in the local scope.
Example:
x = 10
? x # Print 10
test1()
? x # Print 10
test2()
? x # Print 10
func test1
for x = 1 to 5
next
5.9. Default value for object attributes is NULL 64
Ring Documentation, Release 1.9
? x # Print 6
func test2
list = 1:5
for x in list
next
? x # Print NULL (The "For In" loop will kill the reference after the loop)
Output:
10
6
10
NULL
10
5.11 Merge binary characters
From Ring 1.0 we can create binary strings and do operations on these strings.
Now in Ring 1.8, we can get individual characters from these strings and merge them together using the ‘+’ operator.
Example:
cStr = "Welcome"
? cstr[1] + cstr[2] + cStr[5]
v = cstr[1] + cstr[2] + cStr[5]
? v
? len(v)
c1 = cStr[1]
? c1
aList = [1,2,3]
cStr = ""
for item in aList
cStr += int2bytes(item)
next
? "All String"
? len(cStr)
? "First Part"
n1 = cStr[1] + cStr[2] + cStr[3] + cStr[4]
? len(n1)
? "Second Part"
n2 = cStr[5] + cStr[6] + cStr[7] + cStr[8]
? len(n2)
? "Third Part"
n3 = cStr[9] + cStr[10] + cStr[11] + cStr[12]
? len(n3)
? "All String"
cString = cStr[1] + cStr[2] + cStr[3] + cStr[4] +
cStr[5] + cStr[6] + cStr[7] + cStr[8] +
cStr[9] + cStr[10] + cStr[11] + cStr[12]
? len(cString)
? ascii(cStr[1])
? len(cStr[2])
Output:
5.11. Merge binary characters 65
Ring Documentation, Release 1.9
Weo
Weo
3
W
All String
12
First Part
4
Second Part
4 }
Third Part
4
All String
12
1
1
5.12 FoxRing Library
Developer: Jose Rosado
A class with some of the functions I used in FoxPro
Example:
Load "foxring.ring"
mf = new frFunctions
? mf.frAbs(-45)
? mf.frAbs(10-30)
? mf.frAbs(30-10)
? mf.frTransform(" Ring is a good language ",
"@! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
? mf.frAllTrim(" Ring is a good language ", Null)
Output:
45
20
20
RING IS A GOOD LANGUAGE
Ring is a good language
5.13 Better Form Designer
1. Layout Control - Display the control name when loading forms.
2. Button Control - Display the button images written using relative path.
3. Table Control - Display the control name when loading forms.
4. Better behavior in “Bring to front” and “Send to back” operations.
5. New buttons are added to the toolbar (Duplicate, Bring to front, Send to back, Delete).
6. Using layouts in (Menubar designer, Window Flags window, Selecting Objects window).
5.12. FoxRing Library 66
Ring Documentation, Release 1.9
7. Better behavior for displaying the properties window when changing the selected objects.
8. New buttons are added to move and resize multiple selection of objects.
9. Window Properties - Add button to select the layout.
10. Opening forms and switching between files is faster.
11. Objects Order window.
12. Select Objects window.
13. When we change the control name, the name will be updated in layout objects.
5.14 Better Cards Game
The Cards game is updated and we can play with the Computer
5.15 Better RingQt
• The next classes are added to RingQt
1. QTabBar
2. QFile
3. QFileDevice
4. QStandardPaths
5. QDir
6. QQuickWidget
7. QQmlError
5.14. Better Cards Game 67
Ring Documentation, Release 1.9
8. QScrollBar
• RingQt for Android is updated to support modern versions of Qt
Tested using
1. Qt 5.5.1
2. Qt 5.9.5
3. Qt 5.11.0
• In RingQt for Android, The Ring Object File (ringo) will be executed directly from resources.
5.16 Better Code Generator For Extensions
New Option: StaticMethods
Starting from Ring 1.8 the code generator support the staticmethods option.
So the code generator can know that the class doesn’t need an object to call the methods.
Example:
<class>
name: QStandardPaths
para: void
nonew
staticmethods
</class>
QString displayName(QStandardPaths::StandardLocation type)
QString findExecutable(QString executableName, QStringList paths))
5.17 Better Ring Compiler and VM
1. Better loading for files in relative paths
2. Code Optimization for eval() function
3. Better Memory Pool
4. When embedding Ring in Ring, the error in the hosted environment will not close the host
Example:
? "Start the test!"
pState = ring_state_init()
ring_state_runcode(pState," ? 'Let us try having an error' ? x")
ring_state_delete(pState)
? ""
? "End of test!"
Output:
5.16. Better Code Generator For Extensions 68

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.7 book - Part 15 of 196
Mahmoud Samir Fayed
 
PDF
[Greach 17] make concurrency groovy again
Alonso Torres
 
PDF
The Ring programming language version 1.4.1 book - Part 16 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 70 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 175 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.1 book - Part 25 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 53 of 88
Mahmoud Samir Fayed
 
PPTX
Java practice programs for beginners
ishan0019
 
PDF
The Ring programming language version 1.2 book - Part 79 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 43 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4 book - Part 19 of 30
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 7 of 31
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 13 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 208 of 210
Mahmoud Samir Fayed
 
PPT
Lec24
Nikhil Chilwant
 
PDF
The Ring programming language version 1.5.1 book - Part 37 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.2 book - Part 80 of 84
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 90 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 15 of 196
Mahmoud Samir Fayed
 
[Greach 17] make concurrency groovy again
Alonso Torres
 
The Ring programming language version 1.4.1 book - Part 16 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 184 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 70 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 175 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 12 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 25 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 53 of 88
Mahmoud Samir Fayed
 
Java practice programs for beginners
ishan0019
 
The Ring programming language version 1.2 book - Part 79 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 43 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 19 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 7 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 13 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 208 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 37 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 80 of 84
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 90 of 212
Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.9 book - Part 10 of 210 (20)

PDF
The Ring programming language version 1.10 book - Part 12 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 13 of 181
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 9 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4 book - Part 3 of 30
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 17 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 8 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 19 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 14 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.6 book - Part 8 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 92 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 15 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 8 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 14 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 16 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.3 book - Part 6 of 88
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 13 of 185
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.9 book - Part 63 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.3 book - Part 14 of 184
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 20 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.4.1 book - Part 3 of 31
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 12 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 13 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 9 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 3 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 17 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 8 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 19 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 14 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 8 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 92 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 15 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 8 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 14 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 16 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 6 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 13 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 63 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 14 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 20 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 3 of 31
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
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Engineering the Java Web Application (MVC)
abhishekoza1981
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Engineering the Java Web Application (MVC)
abhishekoza1981
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 

The Ring programming language version 1.9 book - Part 10 of 210

  • 1. Ring Documentation, Release 1.9 5.5 StopWatch Application Ring 1.8 comes with StopWatch application 5.5. StopWatch Application 59
  • 2. Ring Documentation, Release 1.9 5.6 More 3D Samples Ring 1.8 comes with more 3D Samples The next screen shot for the Top-Down view - Many levels of cubes sample 5.6. More 3D Samples 60
  • 3. Ring Documentation, Release 1.9 The next screen shot for the Camera Sample The next screen shot for the Camera and background sample Developer : Azzeddine Remmal 5.6. More 3D Samples 61
  • 4. Ring Documentation, Release 1.9 5.7 Compiling on Manjaro Linux Ring 1.8 is tested on Manjaro Linux too Tests by : Iip Rifai 5.7. Compiling on Manjaro Linux 62
  • 5. Ring Documentation, Release 1.9 5.8 Using This in the class region as Self The class region is the region that comes after the class name and before any method. Now we can use This in the class region as Self. Example: func main o1 = new program { test() } ? o1 class program this.name = "My Application" this.version = "1.0" ? name ? version func test ? "Name = " + name ? "Version = " + version Output My Application 1.0 Name = My Application Version = 1.0 name: My Application version: 1.0 Note: When we use braces to change the current active object, Using This we can still point to the class. Tip: The difference between This and Self is that Self point to the current active object that we can change using braces. Remember that in most cases we don’t need to use This or Self in the class region We can write class program name version Or class program name="My Application" version="1.0" Note: We use This or Self in the class region just to avoid conflict with global variables that are defined with the same name. 5.8. Using This in the class region as Self 63
  • 6. Ring Documentation, Release 1.9 5.9 Default value for object attributes is NULL Starting from Ring 1.8 the default value for object attributes is NULL In Ring, the NULL value is just an empty string or a string that contains “NULL” We can check for NULL values using the isNULL() function Example: oProgram = new Program ? oProgram.name ? oProgram.version ? isNULL(oProgram.name) ? isNULL(oProgram.version) oProgram { name="My Application" version="1.0" } ? isNULL(oProgram.name) ? isNULL(oProgram.version) ? oProgram class program name version Output: NULL NULL 1 1 0 0 name: My Application version: 1.0 In previous versions of Ring, trying to access the object attribute before assigning a value to it Will lead to runtime error and you can’t check it using isnull() The only way was assigning a value or using try/catch/end We changed this behavior so we can have full control in seamless way. 5.10 The For Loops uses the local scope In Ring 1.8, when the For Loop defines new identifier (variable) it will define it in the local scope. Example: x = 10 ? x # Print 10 test1() ? x # Print 10 test2() ? x # Print 10 func test1 for x = 1 to 5 next 5.9. Default value for object attributes is NULL 64
  • 7. Ring Documentation, Release 1.9 ? x # Print 6 func test2 list = 1:5 for x in list next ? x # Print NULL (The "For In" loop will kill the reference after the loop) Output: 10 6 10 NULL 10 5.11 Merge binary characters From Ring 1.0 we can create binary strings and do operations on these strings. Now in Ring 1.8, we can get individual characters from these strings and merge them together using the ‘+’ operator. Example: cStr = "Welcome" ? cstr[1] + cstr[2] + cStr[5] v = cstr[1] + cstr[2] + cStr[5] ? v ? len(v) c1 = cStr[1] ? c1 aList = [1,2,3] cStr = "" for item in aList cStr += int2bytes(item) next ? "All String" ? len(cStr) ? "First Part" n1 = cStr[1] + cStr[2] + cStr[3] + cStr[4] ? len(n1) ? "Second Part" n2 = cStr[5] + cStr[6] + cStr[7] + cStr[8] ? len(n2) ? "Third Part" n3 = cStr[9] + cStr[10] + cStr[11] + cStr[12] ? len(n3) ? "All String" cString = cStr[1] + cStr[2] + cStr[3] + cStr[4] + cStr[5] + cStr[6] + cStr[7] + cStr[8] + cStr[9] + cStr[10] + cStr[11] + cStr[12] ? len(cString) ? ascii(cStr[1]) ? len(cStr[2]) Output: 5.11. Merge binary characters 65
  • 8. Ring Documentation, Release 1.9 Weo Weo 3 W All String 12 First Part 4 Second Part 4 } Third Part 4 All String 12 1 1 5.12 FoxRing Library Developer: Jose Rosado A class with some of the functions I used in FoxPro Example: Load "foxring.ring" mf = new frFunctions ? mf.frAbs(-45) ? mf.frAbs(10-30) ? mf.frAbs(30-10) ? mf.frTransform(" Ring is a good language ", "@! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") ? mf.frAllTrim(" Ring is a good language ", Null) Output: 45 20 20 RING IS A GOOD LANGUAGE Ring is a good language 5.13 Better Form Designer 1. Layout Control - Display the control name when loading forms. 2. Button Control - Display the button images written using relative path. 3. Table Control - Display the control name when loading forms. 4. Better behavior in “Bring to front” and “Send to back” operations. 5. New buttons are added to the toolbar (Duplicate, Bring to front, Send to back, Delete). 6. Using layouts in (Menubar designer, Window Flags window, Selecting Objects window). 5.12. FoxRing Library 66
  • 9. Ring Documentation, Release 1.9 7. Better behavior for displaying the properties window when changing the selected objects. 8. New buttons are added to move and resize multiple selection of objects. 9. Window Properties - Add button to select the layout. 10. Opening forms and switching between files is faster. 11. Objects Order window. 12. Select Objects window. 13. When we change the control name, the name will be updated in layout objects. 5.14 Better Cards Game The Cards game is updated and we can play with the Computer 5.15 Better RingQt • The next classes are added to RingQt 1. QTabBar 2. QFile 3. QFileDevice 4. QStandardPaths 5. QDir 6. QQuickWidget 7. QQmlError 5.14. Better Cards Game 67
  • 10. Ring Documentation, Release 1.9 8. QScrollBar • RingQt for Android is updated to support modern versions of Qt Tested using 1. Qt 5.5.1 2. Qt 5.9.5 3. Qt 5.11.0 • In RingQt for Android, The Ring Object File (ringo) will be executed directly from resources. 5.16 Better Code Generator For Extensions New Option: StaticMethods Starting from Ring 1.8 the code generator support the staticmethods option. So the code generator can know that the class doesn’t need an object to call the methods. Example: <class> name: QStandardPaths para: void nonew staticmethods </class> QString displayName(QStandardPaths::StandardLocation type) QString findExecutable(QString executableName, QStringList paths)) 5.17 Better Ring Compiler and VM 1. Better loading for files in relative paths 2. Code Optimization for eval() function 3. Better Memory Pool 4. When embedding Ring in Ring, the error in the hosted environment will not close the host Example: ? "Start the test!" pState = ring_state_init() ring_state_runcode(pState," ? 'Let us try having an error' ? x") ring_state_delete(pState) ? "" ? "End of test!" Output: 5.16. Better Code Generator For Extensions 68