In these days, me and Francesco worked a lot on the window management.
The first good news is that - now - we also have and use the CHILD type; its behavior is like to HMG3.
Another goal achieved was the ability to better manage the forms relationships, usage of forms child of forms.
A more efficient control at creation time and the ability to check "immediately" possible anomalies.
Finally, a more efficient procedure for closing forms.
To achieve these goals, it became necessary to know the type of form during object creation; in other words, within New() method.
This will change the way to write programs in OOP style while, in the XBase commands style, there will be no problems.
1) Structure, relationship.
With HMG4 previous version all windows were (by default) at the same level. This can be a scheme
Code: Select all
<toplevel OR ::s_oToParent>
|
|---------------|-----------------|----------------|---------------|
<Form1> - <Form2> - <MainForm> - <Form3> - <Form4>
Code: Select all
<toplevel OR ::s_oToParent>
|
|----------------|
<MainForm> - <Form1>
|
|---------------|-----------------|----------------|---------------|
<Form2> - <Form3> - <Form4> - <Form5> - <Form6>
|
<Form7>
- 2.1) Only one time can be used a valid character reference to naming a form. ie if "MyFormName" is assigned to form-1, "MyFormName" can't be used to naming form-2
2.2) Only one WND_MAIN form type can exists in a program.
2.3) A WND_MAIN form type must be created before any other form types.
2.4) WND_MAIN parent ALWAYS is the toplevel.
2.5) By default: any new form has, as its parent, WND_MAIN
2.6) A form (not WND_MAIN) can be child of another form
- - MAINWINDOW() to create a WND_MAIN form: the most important form of your application. Only one WND_MAIN can exists in a program and must be created before any other form types. This form will always child of the application in other words "::s_oTopParent". The shared var. ":: s_oMainwindow" will contains the object and method HMGAPP():MainWindow() can be used to know value, not to set.
- MODALWINDOW() to create a WND_MODAL form; its behavior is unchanged. When activated a form of this type, you can only work on itself. To use other forms, including MAINWINDOW, you must proceed with its closure.
- CHILDWINDOW() to create a WND_CHILD form; its characteristic is to be directly subordinated to the MainWindow. If the MainWindow is iconified ChildWindow also automatically will be and, on the status bar, you will see only the MainForm.
- WINDOW() to create a WND_STANDARD form; its characteristics are the current ones.
Because of these innovations, you can not use this syntax:
Code: Select all
WITH OBJECT oVar := WINDOW():New(......
TYPE [WND_MAIN | WND_STANDARD | WND_MODAL | ..... ] <====
- * WITH OBJECT oVar := MAINWINDOW():New( ["name"][, parent] ) to create a WND_MAIN form
* WITH OBJECT oVar := MODALWINDOW():New( ["name"][, parent] ) to create a WND_MODAL form
* WITH OBJECT oVar := CHILDWINDOW():New( ["name"][, parent] ) to create a WND_CHILD form
will require following syntax to create a WND_STANDARD form
* WITH OBJECT oVar := WINDOW():New( ["name"][, parent] )
5) XBase commands syntax.
In addition to the HMG3 commands, have been introduced these other
- * DEFINE MAINWINDOW ReferenceName to create a WND_MAIN form
* DEFINE MODALWINDOW ReferenceName to create a WND_MODAL form
* DEFINE CHILDWINDOW ReferenceName to create a WND_CHILD form
will require following syntax to create a WND_STANDARD form
* DEFINE WINDOW ReferenceName
By default, a "WND_MODAL", "WND_CHILD" or "WND_STANDARD" form will be child of a "WND_MAIN" form.
This involves a longer path to reach its children.
The following syntax "HMGAPP():StandardFormName:ControlName" will not be valid; instead, you'll need usage of
"HMGAPP():MainFormName:StandardFormName:ControlName"
but, both style "OOP" that "XBase commands" programs will be create a var, you will have:
Code: Select all
LOCAL oMoDalForm
........
WITH OBJECT oModalForm := MODALWINDOW():New()
........
WITH OBJECT LABEL():New( "label1" )
........
oModalForm:Label1:Visible := .F.
With Hmg3: when set to OFF /. F. (default on /. T.) and will be hold the button [X], the form will be hidden.
Any onRelease block will be executed when the Release() method will be used or when the MAINFORM will be closed.
the method HMGAPP():WindowsShowAll() was created to show all hidden forms.
Obviously, they will have further tests and improvements. everyone's cooperation is appreciated.
Please: don't do commits; wait my updating. I'm started from built 759. Many thanks
2011-10-21 I have done commit. Topic update 2011-10-22
On the other hand, I will wait HMG4 updating because I have introduced usage of QLibraryInfo class, to handle values from qt.conf file about plugins and translations paths. For this reason, ABOUT HARBOUR COMPILER MINIMUM VERSION REQUIRED WILL BE Harbour 3.1 built r17076
I'm not sure to be able to change every demo; before compile and run take a look and send a message if you found anomalies related to this evolution.
Best regardsRemember:
A) the first form must be a MAIN WINDOW:
- With OOP style this syntax can be used: with object [localvar :=] MAINWINDOW()
- With XBase commands style this syntax can be used:
DEFINE WINDOW name
.....
MAIN
B) other forms in according with new classes using OOP style or right value with DEFINE command using XBase commands style