SlideShare a Scribd company logo
Ring Documentation, Release 1.8
4.5 StopWatch Application
Ring 1.8 comes with StopWatch application
4.5. StopWatch Application 41
Ring Documentation, Release 1.8
4.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
4.6. More 3D Samples 42
Ring Documentation, Release 1.8
The next screen shot for the Camera Sample
The next screen shot for the Camera and background sample
Developer : Azzeddine Remmal
4.6. More 3D Samples 43
Ring Documentation, Release 1.8
4.7 Compiling on Manjaro Linux
Ring 1.8 is tested on Manjaro Linux too
Tests by : Iip Rifai
4.7. Compiling on Manjaro Linux 44
Ring Documentation, Release 1.8
4.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.
4.8. Using This in the class region as Self 45
Ring Documentation, Release 1.8
4.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.
4.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
4.9. Default value for object attributes is NULL 46
Ring Documentation, Release 1.8
? 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
4.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:
4.11. Merge binary characters 47
Ring Documentation, Release 1.8
Weo
Weo
3
W
All String
12
First Part
4
Second Part
4 }
Third Part
4
All String
12
1
1
4.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
4.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).
4.12. FoxRing Library 48
Ring Documentation, Release 1.8
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.
4.14 Better Cards Game
The Cards game is updated and we can play with the Computer
4.15 Better RingQt
• The next classes are added to RingQt
1. QTabBar
2. QFile
3. QFileDevice
4. QStandardPaths
5. QDir
6. QQuickWidget
7. QQmlError
4.14. Better Cards Game 49
Ring Documentation, Release 1.8
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.
4.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))
4.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:
4.16. Better Code Generator For Extensions 50

More Related Content

What's hot (20)

PDF
The Ring programming language version 1.5.1 book - Part 25 of 180
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 26 of 181
Mahmoud Samir Fayed
 
PPT
Threads
RanjithaM32
 
PDF
The Ring programming language version 1.10 book - Part 102 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 35 of 212
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 92 of 196
Mahmoud Samir Fayed
 
PDF
Clojure class
Aysylu Greenberg
 
PDF
Agile Developer Immersion Workshop, LASTconf Melbourne, Australia, 19th July ...
Victoria Schiffer
 
PDF
The Ring programming language version 1.7 book - Part 7 of 196
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.7 book - Part 30 of 196
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.8 book - Part 31 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.2 book - Part 25 of 181
Mahmoud Samir Fayed
 
PPT
Inheritance and-polymorphism
Usama Malik
 
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 189 of 194
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.5.4 book - Part 13 of 185
Mahmoud Samir Fayed
 
PPT
Object - Based Programming
Andy Juan Sarango Veliz
 
PDF
Advanced Java Practical File
Soumya Behera
 
The Ring programming language version 1.5.1 book - Part 25 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 26 of 181
Mahmoud Samir Fayed
 
Threads
RanjithaM32
 
The Ring programming language version 1.10 book - Part 102 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 35 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 92 of 196
Mahmoud Samir Fayed
 
Clojure class
Aysylu Greenberg
 
Agile Developer Immersion Workshop, LASTconf Melbourne, Australia, 19th July ...
Victoria Schiffer
 
The Ring programming language version 1.7 book - Part 7 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 30 of 196
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.8 book - Part 31 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 25 of 181
Mahmoud Samir Fayed
 
Inheritance and-polymorphism
Usama Malik
 
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 189 of 194
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 13 of 185
Mahmoud Samir Fayed
 
Object - Based Programming
Andy Juan Sarango Veliz
 
Advanced Java Practical File
Soumya Behera
 

Similar to The Ring programming language version 1.8 book - Part 8 of 202 (20)

PDF
The Ring programming language version 1.9 book - Part 12 of 210
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.6 book - Part 7 of 189
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.10 book - Part 12 of 212
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 10 of 202
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.8 book - Part 17 of 202
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.3 book - Part 6 of 88
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.9 book - Part 17 of 210
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 92 of 202
Mahmoud Samir Fayed
 
PDF
The Ring programming language version 1.8 book - Part 15 of 202
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 15 of 185
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.5.3 book - Part 11 of 184
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.8 book - Part 14 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 12 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 8 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 7 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 12 of 212
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 10 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 8 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 17 of 202
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.3 book - Part 6 of 88
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.9 book - Part 17 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 92 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 15 of 202
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 15 of 185
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.5.3 book - Part 11 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 9 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 14 of 202
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
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 

The Ring programming language version 1.8 book - Part 8 of 202

  • 1. Ring Documentation, Release 1.8 4.5 StopWatch Application Ring 1.8 comes with StopWatch application 4.5. StopWatch Application 41
  • 2. Ring Documentation, Release 1.8 4.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 4.6. More 3D Samples 42
  • 3. Ring Documentation, Release 1.8 The next screen shot for the Camera Sample The next screen shot for the Camera and background sample Developer : Azzeddine Remmal 4.6. More 3D Samples 43
  • 4. Ring Documentation, Release 1.8 4.7 Compiling on Manjaro Linux Ring 1.8 is tested on Manjaro Linux too Tests by : Iip Rifai 4.7. Compiling on Manjaro Linux 44
  • 5. Ring Documentation, Release 1.8 4.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. 4.8. Using This in the class region as Self 45
  • 6. Ring Documentation, Release 1.8 4.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. 4.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 4.9. Default value for object attributes is NULL 46
  • 7. Ring Documentation, Release 1.8 ? 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 4.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: 4.11. Merge binary characters 47
  • 8. Ring Documentation, Release 1.8 Weo Weo 3 W All String 12 First Part 4 Second Part 4 } Third Part 4 All String 12 1 1 4.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 4.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). 4.12. FoxRing Library 48
  • 9. Ring Documentation, Release 1.8 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. 4.14 Better Cards Game The Cards game is updated and we can play with the Computer 4.15 Better RingQt • The next classes are added to RingQt 1. QTabBar 2. QFile 3. QFileDevice 4. QStandardPaths 5. QDir 6. QQuickWidget 7. QQmlError 4.14. Better Cards Game 49
  • 10. Ring Documentation, Release 1.8 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. 4.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)) 4.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: 4.16. Better Code Generator For Extensions 50