New Sample - How to use a Subform as a Modal Dialogue (Ver. 188.8.131.525)
Download Modal Dialogue Sample
As you might have discovered by now, one of the main goals of DE 8 is to allow the developer to develop contemporary and advanced End User applications.
It is no secret that DataEase applications have suffered from DIY GUI functionality, and it has been hard to make an application "idiot proof".
One especially annoying feature of DFW is the "all windows of one type" problem. If you load a form as Normalized all other open documents will immediately be Normalized too. Very nice...
Sadly this "feature" is DFW DNA due to the use of the MS Windows MDI model and to remove it basically means making DFW from scratch.
When you can't beat it, join it!
Our scope in DE8 development is to improve the product as much as possible from a developer and user experience viewpoint without radically re-developing it, hence keeping backwards compatibility.
With the new SetClass(), MoveClass(), ExecDQLClass() etc, functionalty we have given the developer a completely new control of their app and what we want to showcase here is how these features and changes in combination with DEs fantastic relational capabilities give you much more than a straightforward removal of the Windows model limitation would have done.
Different Windows are Different "programs". The communication and control one window can excise on another is very limited, but if you make that other WIndow part of your form, you can basically play across the divide like it wasn't there...
In this sample we show you how you with simple "trickery" can create the longed for Modal dialogue.
The things to look for here is the Manip field, the Action on the Big green button and the code on the close X button on the modal form.
You might wonder why we have placed the subform and button outside the main form and that is due to the way DataEase prioritise fields for display. Fields further down and further to the right is on top of fields further up and to the left. To avoid fields to conflict with our dialogue we simply place them further down and to the right as runtime re-positioning won't interfere with the priority.
Another thing you might test is to make the window so small so the Manip field end up outside the visible window when you go back to runtime. When this happens you will see that ....nothing happens. This is because DataEase will only execute fields that are inside the visible viewport when you first load the form. So a word of advice...always put your wizzardry fields as close to the upper left corner as possible...
You might see that the background changes to dark and the fields go disabled when you click the button and the Modal dialogue is displayed.
This is not "magic" or automatic. We simply change the style on the main record (Record1 - beware that when you crate a form the main record will be named Record, but after reloading it the second time it will have changed name to Record1 which it will keep for ever. This is a bug and we will fix, but it has been like this for 20 years but not a big problem since very few people started on this kind of wizardry on day one...)
This shwo how strong the SetStyle() function is. You can change all features of an object by simply changing the style.
Before we end we just want to point out the disabling we do. We disable the entire Form and then we re-enable the Subform.
SetState("OpenButton",0)+SetStyle("Record1","Disabled")+SetState("Record1",2)+SetState("System - Info",3)+SetState("System - Info",1)