You are on page 1of 10

Ring Documentation, Release 1.

7.11. What is new in Ring 1.4.1? 112


CHAPTER

EIGHT

WHAT IS NEW IN RING 1.3?

In this chapter we will learn about the changes and new features in Ring 1.3 release.

8.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

8.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("")

113
Ring Documentation, Release 1.7

}
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:

8.2. Better RingQt 114


Ring Documentation, Release 1.7

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)

8.2. Better RingQt 115


Ring Documentation, Release 1.7

func SendMessage
if IsSecondWindow()
SecondWindow().setMessage("Message from the first window")
ok

func setMessage cMessage


oView.Label1.setText(cMessage)

3. The next classes are added to RingQt


• QPixMap2
• QScrollArea
• QSplitter
• QCompleter
• QCompleter2
• QCompleter3
• QProcess
• QMdiArea
• QMdiSubWindow
• QCursor
• QListView
• QDesktopServices
4. Many constants are defined in qt.rh (loaded by guilib.ring)
5. New Classes names - Index Start from 1
We added new classes to RingQt - another version of classes where the class names doesn’t 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 doesn’t have any effect on our previous code, It’s 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

8.2. Better RingQt 116


Ring Documentation, Release 1.7

2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/indexstart/indexstartController.ring

8.3 Better Ring Notepad

1. Using QPlainTextEdit instead of QTextEdit


2. Displaying the line number for each line in the source code file.
Screen Shot:

3. Auto-Complete for Ring functions names, classes and words in the opened file.

8.3. Better Ring Notepad 117


Ring Documentation, Release 1.7

4. Functions and Methods List

8.3. Better Ring Notepad 118


Ring Documentation, Release 1.7

5. Output Window

6. Classes List

8.3. Better Ring Notepad 119


Ring Documentation, Release 1.7

7. Change the Current Style

8.4 Ring mode for Emacs Editor

Ring 1.3 comes with Ring mode for Emacs Editor


Screen Shot:

8.4. Ring mode for Emacs Editor 120


Ring Documentation, Release 1.7

8.5 Better StdLib

The StdLib is updated to include the next functions


• SplitMany()
• JustFilePath()
• JustFileName()

8.6 Better Loop|Exit Command

The Loop|Exit command is updated to accept Expressions after the command (not only numbers).
The syntax:
Loop|Exit [Number]

Changed to
Loop|Exit [Expression]

Example
XLoop = 2 # The outer loop
YLoop = 1 # The first inner loop
for x = 1 to 10
for y = 1 to 10
see "x=" + x + " y=" + y + nl
if x = 3 and y = 5
exit XLoop
ok

8.5. Better StdLib 121

You might also like