SlideShare a Scribd company logo
Ring Documentation, Release 1.8
• The User Can click on the button many times to open many sub windows.
• Each Sub Window contains Two buttons.
• The first button in the sub window change the Main and the Sub Windows Titles.
• The second button in the sub window close the Sub Window.
load "guilib.ring"
new qApp {
open_window( :MainWindowController )
exec()
}
class MainWindowController from WindowsControllerParent
oView = new MainWindowView
func SubWindowAction
Open_window( :SubWindowController )
Last_Window().SetParentObject(self)
class MainWindowView from WindowsViewParent
win = new qWidget() {
SetWindowTitle("Main Window")
btnSub = new qPushButton(win) {
setText("Sub Window")
setClickEvent( Method( :SubWindowAction ) )
}
resize(400,400)
}
class SubWindowController from WindowsControllerParent
oView = new SubWindowView
func SetMainWindowTitleAction
Parent().oView.win.SetWindowTitle("Message from the Sub Window")
oView.win.SetWindowTitle("Click Event Done!")
class SubWindowView from WindowsViewParent
win = new qWidget() {
SetWindowTitle("Sub Window")
btnMsg = new qPushButton(win) {
setText("Set Main Window Title")
setClickEvent( Method( :SetMainWindowTitleAction ) )
}
btnClose = new qPushButton(win) {
Move(200,0)
setText("Close")
setClickEvent( Method( :CloseAction ) )
}
resize(400,400)
}
The next screen shot after creating three sub windows.
62.2. Example 741
Ring Documentation, Release 1.8
The next screen shot after clicking on the button in each sub window.
62.2. Example 742
Ring Documentation, Release 1.8
62.3 Open_WindowAndLink() Function
We can use the Open_WindowAndLink() function to connect between the application windows, pass messages (call
methods) between the objects.
This function uses Meta-programming to define dynamic methods in the Caller Class to use the dynamic objects of
other windows that we create.
Example : (Uses the Form Designer)
First Window
1. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/firstwindowView.ring
2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/firstwindowController.ring
Second Window
1. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/secondwindowView.ring
2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/secondwindowController.ring
62.3. Open_WindowAndLink() Function 743
Ring Documentation, Release 1.8
In the next code for example (from FirstWindowController.ring)
The Open_WindowAndLink() will create an object from the SecondWindowController Class
Then will add the Method : SecondWindow(), IsSecondWindow() Methods to the FirstWindowController Class
Also will add the Method : FirstWindow(), IsFirstWindow() Methods to the SecondWindowController Class
So the SendMessage() method in FirstWindowController class can use the SecondWindow() method to access the
object.
This is more simple than using Last_Window(), Parent() and SetParentObject() methods.
class firstwindowController from windowsControllerParent
oView = new firstwindowView
func OpenSecondWindow
Open_WindowAndLink(:SecondWindowController,self)
func SendMessage
if IsSecondWindow()
SecondWindow().setMessage("Message from the first window")
ok
func setMessage cMessage
oView.Label1.setText(cMessage)
62.4 Open_WindowInPackages() Function
The Open_WindowInPackages() function is the same as Open_Window() but takes an extra list that determine the
packages to import before opening the window.
Syntax:
Open_WindowInPackages(cClassName,aPackagesList)
Example:
The next example from the Form Designer source code, Open the Window Flags window using the
open_windowInPackages() function.
We determine the class name “WindowFlagsController” and the packages name.
The Window Flags window uses the FormDesigner and System.GUI packages.
open_windowInPackages(:WindowFlagsController,[
"formdesigner",
"System.GUI"
])
62.5 Objects Library Source Code
The library source code is very simple, You can check the source code files
• https://github.com/ring-lang/ring/blob/master/extensions/ringqt/objectslib/objects.ring
• https://github.com/ring-lang/ring/blob/master/extensions/ringqt/objectslib/subwindows.ring
62.4. Open_WindowInPackages() Function 744
CHAPTER
SIXTYTHREE
USING THE FORM DESIGNER
In this chapter we will learn about using the Form Designer.
We can run the From Designer from Ring Notepad
From the Menubar in Ring Notepad - View Menu - We can Show/Hide the Form Designer window.
Also we can run the Form Designer in another window.
From the Ring Notepad - Tools Menu - Select the Form Designer.
745
Ring Documentation, Release 1.8
63.1 The Designer Windows
• Toolbox : To select controls to be added to the window.
• Properties : To set the properties of the active window or controls.
• Design Region : To select, move and resize the window and the controls.
63.2 The Toolbox
We have many buttons.
• Lock : We can use it to draw many controls of the same type quickly.
• Select : We can use it to select a control in the Design Region
• Controls Buttons : Select a control to be added to the window.
63.3 The Properties
• When we select the window or one control, We will have the selected object properties.
• Also In the properties window we have a combobox to select the active control.
• Some properties provide a button next to the property value. We can click on the button to get more options.
• When we select more than one control, We will have options for multi-selection
63.1. The Designer Windows 746
Ring Documentation, Release 1.8
63.4 Running Forms
When we save the form file (*.rform), The Form Designer will create two Ring files
• The Controller Class
• The View Class
For example, if the form file is helloworld.rform
The form designer will generate two files
• helloworldcontroller.ring
• helloworldview.ring
To run the program, Open the controller class file then click the Run button (CTRL+F5)
Tip: When you open a form using Ring Notepad, the controller class will be opened automatically, So we can press
(CTRL+F5) or click on the Run button while the form designer window is active.
63.5 Events Code
1. Just type the method name in the event property.
63.4. Running Forms 747
Ring Documentation, Release 1.8
(2) Then write the method code in the controller class.
63.5. Events Code 748
Ring Documentation, Release 1.8
In this example we write
func CloseWindow
oView.win.close()
Where inside the controller class, We uses the oView object to access the form.
Another Example :
63.5. Events Code 749
Ring Documentation, Release 1.8
The Event Code
func SayHello
oView {
LineEdit2.setText("Hello "+ LineEdit1.text() )
}
63.6 Keyboard Shortcuts
After selecting one or group of controls
• Use the Arrows (Up, Down, Left and Right) to move them around.
• Shift + the Arrows (Up, Down, Left and Right) to Resize the controls.
• Del button to delete the controls.
• CTRL+SHIFT+V to Duplicate the controls.
63.7 Menubar Designer
From the Window properties we can open the Menubar Designer
63.6. Keyboard Shortcuts 750

More Related Content

PDF
The Ring programming language version 1.7 book - Part 76 of 196
PDF
The Ring programming language version 1.9 book - Part 82 of 210
PDF
The Ring programming language version 1.5.4 book - Part 71 of 185
PDF
The Ring programming language version 1.5.1 book - Part 67 of 180
PDF
The Ring programming language version 1.6 book - Part 73 of 189
PDF
Константин Чернухо_Popups, alerts and windows
PDF
The Ring programming language version 1.10 book - Part 83 of 212
PDF
iOS UI Testing in Xcode
The Ring programming language version 1.7 book - Part 76 of 196
The Ring programming language version 1.9 book - Part 82 of 210
The Ring programming language version 1.5.4 book - Part 71 of 185
The Ring programming language version 1.5.1 book - Part 67 of 180
The Ring programming language version 1.6 book - Part 73 of 189
Константин Чернухо_Popups, alerts and windows
The Ring programming language version 1.10 book - Part 83 of 212
iOS UI Testing in Xcode

What's hot (9)

PPTX
iOS Automation: XCUITest + Gherkin
PDF
Programming Without Coding Technology (PWCT) - ShellExplorer Sample
PDF
Events and Listeners in Android
PDF
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
PDF
iOS Contact List Application Tutorial
PPTX
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
PPT
Swtbot
PDF
Practical JavaScript Programming - Session 8/8
PDF
Programming Without Coding Technology (PWCT) - Internet Explorer ActiveX Control
iOS Automation: XCUITest + Gherkin
Programming Without Coding Technology (PWCT) - ShellExplorer Sample
Events and Listeners in Android
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
iOS Contact List Application Tutorial
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Swtbot
Practical JavaScript Programming - Session 8/8
Programming Without Coding Technology (PWCT) - Internet Explorer ActiveX Control
Ad

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

PDF
The Ring programming language version 1.3 book - Part 54 of 88
PDF
The Ring programming language version 1.5.2 book - Part 68 of 181
PDF
The Ring programming language version 1.6 book - Part 74 of 189
PDF
The Ring programming language version 1.5.3 book - Part 81 of 184
PDF
The Ring programming language version 1.10 book - Part 84 of 212
PDF
The Ring programming language version 1.2 book - Part 51 of 84
PDF
The Ring programming language version 1.10 book - Part 72 of 212
PDF
The Ring programming language version 1.5.1 book - Part 68 of 180
PDF
The Ring programming language version 1.3 book - Part 7 of 88
PPT
Oracle 10g Forms Lesson 15
PPT
PDF
Programming Without Coding Technology (PWCT) - Richeditbox control
PDF
Programming Without Coding Technology (PWCT) - Checkbox control
PDF
Programming Without Coding Technology (PWCT) - Slider control
PDF
Programming Without Coding Technology (PWCT) - Editbox control
PDF
Programming Without Coding Technology (PWCT) - Grid control
PDF
Programming Without Coding Technology (PWCT) - Checkbutton control
PDF
Programming Without Coding Technology (PWCT) - Spinner control
PDF
The Ring programming language version 1.10 book - Part 20 of 212
PDF
The Ring programming language version 1.6 book - Part 14 of 189
The Ring programming language version 1.3 book - Part 54 of 88
The Ring programming language version 1.5.2 book - Part 68 of 181
The Ring programming language version 1.6 book - Part 74 of 189
The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.10 book - Part 84 of 212
The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.5.1 book - Part 68 of 180
The Ring programming language version 1.3 book - Part 7 of 88
Oracle 10g Forms Lesson 15
Programming Without Coding Technology (PWCT) - Richeditbox control
Programming Without Coding Technology (PWCT) - Checkbox control
Programming Without Coding Technology (PWCT) - Slider control
Programming Without Coding Technology (PWCT) - Editbox control
Programming Without Coding Technology (PWCT) - Grid control
Programming Without Coding Technology (PWCT) - Checkbutton control
Programming Without Coding Technology (PWCT) - Spinner control
The Ring programming language version 1.10 book - Part 20 of 212
The Ring programming language version 1.6 book - Part 14 of 189
Ad

More from Mahmoud Samir Fayed (20)

PDF
The Ring programming language version 1.10 book - Part 212 of 212
PDF
The Ring programming language version 1.10 book - Part 211 of 212
PDF
The Ring programming language version 1.10 book - Part 210 of 212
PDF
The Ring programming language version 1.10 book - Part 208 of 212
PDF
The Ring programming language version 1.10 book - Part 207 of 212
PDF
The Ring programming language version 1.10 book - Part 205 of 212
PDF
The Ring programming language version 1.10 book - Part 206 of 212
PDF
The Ring programming language version 1.10 book - Part 204 of 212
PDF
The Ring programming language version 1.10 book - Part 203 of 212
PDF
The Ring programming language version 1.10 book - Part 202 of 212
PDF
The Ring programming language version 1.10 book - Part 201 of 212
PDF
The Ring programming language version 1.10 book - Part 200 of 212
PDF
The Ring programming language version 1.10 book - Part 199 of 212
PDF
The Ring programming language version 1.10 book - Part 198 of 212
PDF
The Ring programming language version 1.10 book - Part 197 of 212
PDF
The Ring programming language version 1.10 book - Part 196 of 212
PDF
The Ring programming language version 1.10 book - Part 195 of 212
PDF
The Ring programming language version 1.10 book - Part 194 of 212
PDF
The Ring programming language version 1.10 book - Part 193 of 212
PDF
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 192 of 212

Recently uploaded (20)

PDF
AI in Product Development-omnex systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Essential Infomation Tech presentation.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
System and Network Administraation Chapter 3
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
AI in Product Development-omnex systems
How to Migrate SBCGlobal Email to Yahoo Easily
Upgrade and Innovation Strategies for SAP ERP Customers
Essential Infomation Tech presentation.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo POS Development Services by CandidRoot Solutions
2025 Textile ERP Trends: SAP, Odoo & Oracle
How Creative Agencies Leverage Project Management Software.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Navsoft: AI-Powered Business Solutions & Custom Software Development
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
System and Network Administraation Chapter 3
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
How to Choose the Right IT Partner for Your Business in Malaysia
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf

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

  • 1. Ring Documentation, Release 1.8 • The User Can click on the button many times to open many sub windows. • Each Sub Window contains Two buttons. • The first button in the sub window change the Main and the Sub Windows Titles. • The second button in the sub window close the Sub Window. load "guilib.ring" new qApp { open_window( :MainWindowController ) exec() } class MainWindowController from WindowsControllerParent oView = new MainWindowView func SubWindowAction Open_window( :SubWindowController ) Last_Window().SetParentObject(self) class MainWindowView from WindowsViewParent win = new qWidget() { SetWindowTitle("Main Window") btnSub = new qPushButton(win) { setText("Sub Window") setClickEvent( Method( :SubWindowAction ) ) } resize(400,400) } class SubWindowController from WindowsControllerParent oView = new SubWindowView func SetMainWindowTitleAction Parent().oView.win.SetWindowTitle("Message from the Sub Window") oView.win.SetWindowTitle("Click Event Done!") class SubWindowView from WindowsViewParent win = new qWidget() { SetWindowTitle("Sub Window") btnMsg = new qPushButton(win) { setText("Set Main Window Title") setClickEvent( Method( :SetMainWindowTitleAction ) ) } btnClose = new qPushButton(win) { Move(200,0) setText("Close") setClickEvent( Method( :CloseAction ) ) } resize(400,400) } The next screen shot after creating three sub windows. 62.2. Example 741
  • 2. Ring Documentation, Release 1.8 The next screen shot after clicking on the button in each sub window. 62.2. Example 742
  • 3. Ring Documentation, Release 1.8 62.3 Open_WindowAndLink() Function We can use the Open_WindowAndLink() function to connect between the application windows, pass messages (call methods) between the objects. This function uses Meta-programming to define dynamic methods in the Caller Class to use the dynamic objects of other windows that we create. Example : (Uses the Form Designer) First Window 1. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/firstwindowView.ring 2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/firstwindowController.ring Second Window 1. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/secondwindowView.ring 2. https://github.com/ring-lang/ring/blob/master/applications/formdesigner/tests/twowindowspart5/secondwindowController.ring 62.3. Open_WindowAndLink() Function 743
  • 4. Ring Documentation, Release 1.8 In the next code for example (from FirstWindowController.ring) The Open_WindowAndLink() will create an object from the SecondWindowController Class Then will add the Method : SecondWindow(), IsSecondWindow() Methods to the FirstWindowController Class Also will add the Method : FirstWindow(), IsFirstWindow() Methods to the SecondWindowController Class So the SendMessage() method in FirstWindowController class can use the SecondWindow() method to access the object. This is more simple than using Last_Window(), Parent() and SetParentObject() methods. class firstwindowController from windowsControllerParent oView = new firstwindowView func OpenSecondWindow Open_WindowAndLink(:SecondWindowController,self) func SendMessage if IsSecondWindow() SecondWindow().setMessage("Message from the first window") ok func setMessage cMessage oView.Label1.setText(cMessage) 62.4 Open_WindowInPackages() Function The Open_WindowInPackages() function is the same as Open_Window() but takes an extra list that determine the packages to import before opening the window. Syntax: Open_WindowInPackages(cClassName,aPackagesList) Example: The next example from the Form Designer source code, Open the Window Flags window using the open_windowInPackages() function. We determine the class name “WindowFlagsController” and the packages name. The Window Flags window uses the FormDesigner and System.GUI packages. open_windowInPackages(:WindowFlagsController,[ "formdesigner", "System.GUI" ]) 62.5 Objects Library Source Code The library source code is very simple, You can check the source code files • https://github.com/ring-lang/ring/blob/master/extensions/ringqt/objectslib/objects.ring • https://github.com/ring-lang/ring/blob/master/extensions/ringqt/objectslib/subwindows.ring 62.4. Open_WindowInPackages() Function 744
  • 5. CHAPTER SIXTYTHREE USING THE FORM DESIGNER In this chapter we will learn about using the Form Designer. We can run the From Designer from Ring Notepad From the Menubar in Ring Notepad - View Menu - We can Show/Hide the Form Designer window. Also we can run the Form Designer in another window. From the Ring Notepad - Tools Menu - Select the Form Designer. 745
  • 6. Ring Documentation, Release 1.8 63.1 The Designer Windows • Toolbox : To select controls to be added to the window. • Properties : To set the properties of the active window or controls. • Design Region : To select, move and resize the window and the controls. 63.2 The Toolbox We have many buttons. • Lock : We can use it to draw many controls of the same type quickly. • Select : We can use it to select a control in the Design Region • Controls Buttons : Select a control to be added to the window. 63.3 The Properties • When we select the window or one control, We will have the selected object properties. • Also In the properties window we have a combobox to select the active control. • Some properties provide a button next to the property value. We can click on the button to get more options. • When we select more than one control, We will have options for multi-selection 63.1. The Designer Windows 746
  • 7. Ring Documentation, Release 1.8 63.4 Running Forms When we save the form file (*.rform), The Form Designer will create two Ring files • The Controller Class • The View Class For example, if the form file is helloworld.rform The form designer will generate two files • helloworldcontroller.ring • helloworldview.ring To run the program, Open the controller class file then click the Run button (CTRL+F5) Tip: When you open a form using Ring Notepad, the controller class will be opened automatically, So we can press (CTRL+F5) or click on the Run button while the form designer window is active. 63.5 Events Code 1. Just type the method name in the event property. 63.4. Running Forms 747
  • 8. Ring Documentation, Release 1.8 (2) Then write the method code in the controller class. 63.5. Events Code 748
  • 9. Ring Documentation, Release 1.8 In this example we write func CloseWindow oView.win.close() Where inside the controller class, We uses the oView object to access the form. Another Example : 63.5. Events Code 749
  • 10. Ring Documentation, Release 1.8 The Event Code func SayHello oView { LineEdit2.setText("Hello "+ LineEdit1.text() ) } 63.6 Keyboard Shortcuts After selecting one or group of controls • Use the Arrows (Up, Down, Left and Right) to move them around. • Shift + the Arrows (Up, Down, Left and Right) to Resize the controls. • Del button to delete the controls. • CTRL+SHIFT+V to Duplicate the controls. 63.7 Menubar Designer From the Window properties we can open the Menubar Designer 63.6. Keyboard Shortcuts 750