Professional Documents
Culture Documents
The next screen shot after clicking on the button in each sub window.
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
func OpenSecondWindow
Open_WindowAndLink(:SecondWindowController,self)
func SendMessage
if IsSecondWindow()
SecondWindow().setMessage("Message from the first window")
ok
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
FIFTYTWO
511
Ring Documentation, Release 1.3
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
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.
Where inside the controller class, We uses the oView object to access the form.
Another Example :
From the Window properties we can open the Window Flags window.