Apidays New York 2024 - The value of a flexible API Management solution for O...
Â
The Ring programming language version 1.5.4 book - Part 12 of 185
1. Ring Documentation, Release 1.5.4
⢠Bytes2Double()
Example:
see "Test Int2Bytes() and Bytes2Int() - Value : 77" + nl
r = Int2Bytes(77)
see "Int Size : " + len(r) + nl
see r + nl
see Bytes2Int(r) + nl
see "Test Float2Bytes() and Bytes2Float() - Value 77.12" + nl
r = Float2Bytes(77.12)
see "Float Size : " + len(r) + nl
see r + nl
see Bytes2Float(r) + nl
see "Test Double2Bytes() and Bytes2Double() - Value 9999977.12345" + nl
r = Double2Bytes(9999977.12345)
see "Double Size : " + len(r) + nl
see r + nl
decimals(5)
see Bytes2Double(r) + nl
5.7 Better StdLib
The StdLib is updated to include the next functions
⢠FSize()
The print() function is updated to accept local variables.
load "stdlib.ring"
func main
print("Enter your name : ") ;
Name = getString() ;
print( "Hello : #{Name} ") ;
return ;
5.8 Better WebLib
The web library is updated
⢠Provide better error message
1. Error (WebLib-1) : REQUEST_METHOD is empty ! - Run this script from the browser
2. Error (DataLib-1) : Canât connect to the database server!
⢠Better Template() function - can accept NULL instead of object as the second paramter.
html(template("main.rhtml",NULL))
⢠The Form Class is updated to support the âtargetâ attribute.
BootStrapWebPage()
{
Title = "The Ring Programming Language"
html(template("main.rhtml",NULL))
5.7. Better StdLib 85
3. Ring Documentation, Release 1.5.4
}
}
}
html(template("footer.rhtml",NULL))
}
5.9 Better RingQt
The next functions are added to RingQt
⢠SetDialogIcon(cIconFile)
⢠MsgInfo(cTitle,cMessage)
⢠ConďŹrmMsg(cTitle,cMessage)
⢠InputBox(cTitle,cMessage)
⢠InputBoxInt(cTitle,cMessage)
⢠InputBoxNum(cTitle,cMessage)
⢠InputBoxPass(cTitle,cMessage)
The next classes are added to RingQt
⢠QToolButton
⢠QSerialPort
⢠QSerialPortInfo
5.10 Qt Class Convertor
Ring 1.4 comes with a simple tool that help in porting Qt classes to RingQt.
You will ďŹnd it in ring/samples/tools/QtClassConverter
Online : https://github.com/ring-lang/ring/tree/master/samples/tools/QtClassConverter
Screen Shot:
5.9. Better RingQt 87
4. Ring Documentation, Release 1.5.4
5.11 What is new in Ring 1.4.1?
Ring 1.4.1 comes with the next changes
⢠Better Scripts for Building from Source Code
⢠Better Colors for the Modern Style in Ring Notepad
⢠Better StdLib
⢠Better RingQt
⢠New Sample : Sixteen Puzzle
The scripts are updated for building from source code.
Tested using Windows, Ubuntu Linux, Linux Mint and MacOS X.
Screen Shot:
5.11. What is new in Ring 1.4.1? 88
5. Ring Documentation, Release 1.5.4
In Ring Notepad - the (Modern) Style colors are updated
Screen Shot:
The StdLib is updated to include the next functions
⢠TrimLeft()
⢠TrimRight()
⢠TrimAll()
⢠EpochTime()
5.11. What is new in Ring 1.4.1? 89
6. Ring Documentation, Release 1.5.4
The next functions are updated to display the dialogs on the top of other windows.
⢠SetDialogIcon(cIconFile)
⢠MsgInfo(cTitle,cMessage)
⢠ConďŹrmMsg(cTitle,cMessage)
⢠InputBox(cTitle,cMessage)
⢠InputBoxInt(cTitle,cMessage)
⢠InputBoxNum(cTitle,cMessage)
⢠InputBoxPass(cTitle,cMessage)
The Sixteen Puzzle is added to the Applications folder.
Screen Shot:
5.11. What is new in Ring 1.4.1? 90
8. CHAPTER
SIX
WHAT IS NEW IN RING 1.3?
In this chapter we will learn about the changes and new features in Ring 1.3 release.
6.1 List of changes and new features
Ring 1.3 comes with many new features
⢠Better RingQt
⢠Better Ring Notepad
⢠Ring mode for Emacs Editor
⢠Better StdLib
⢠Better Loop/Exit Command
⢠New Functions
⢠Return Self by Reference
⢠Using â<â and â:â operators as âfromâ keyword
⢠Embedding Ring in Ring without sharing the State
⢠RingZip Library
⢠Form Designer
6.2 Better RingQt
(1) Another version of QPixMap class is added (QPixMap2) which takes (int width,int height) during object init.
Example:
Load "guilib.ring"
New qapp
{
win1 = new qwidget()
{
setwindowtitle("Drawing using QPixMap")
setgeometry(100,100,500,500)
label1 = new qlabel(win1)
{
setgeometry(10,10,400,400)
settext("")
92
9. Ring Documentation, Release 1.5.4
}
imageStock = new qlabel(win1)
{
image = new qPixMap2(200,200)
color = new qcolor() {
setrgb(255,255,255,255)
}
pen = new qpen() {
setcolor(color)
setwidth(10)
}
new qpainter() {
begin(image)
setpen(pen)
drawline(0,0,200,200)
drawline(200,0,0,200)
endpaint()
}
setpixmap(image)
}
show()
}
exec()
}
Screen Shot:
6.2. Better RingQt 93
10. Ring Documentation, Release 1.5.4
2. The Objects Library is updated to include the next functions
⢠Last_WindowID()
⢠Open_WindowNoShow()
⢠Open_WindowAndLink()
Also the class name (WindowViewBase) is changed to (WindowsViewParent).
In The next code for example the Open_WindowAndLink() will create an object from the SecondWindowController
Class Then will add the Method SecondWindow() to the FirstWindowController Class Also will add the Method
FirstWindow() to the SecondWindowController Class
So the SendMessage() method in FirstWindowController class can use the SecondWindow() method to access the
object.
class firstwindowController from windowsControllerParent
oView = new firstwindowView
func OpenSecondWindow
Open_WindowAndLink(:SecondWindowController,self)
6.2. Better RingQt 94