Simplicty and flexibility!


DE85- 100% control of the USER!

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

DE85- 100% control of the USER!

Download Sample


We got a request on the form about how to use Modal and switch between forms that were already open.

It is not always easy to "guess" what you guys mean but as we have a little experience with both DataEase and the customers/users our guess would be that the question was about control of the interface.

The interactivity of WIndows systems can be very confusing for users so sometimes we simply want to make sure they only do things in the order WE want.

Some of you might have dabbled with Modal and "give up" as it is a very invasive functionality and it basically render the rest of DataEase "useless" when you switch a document to Modal.

Toolbars, catalog, file menu, shortcuts -  basically EVERYTHING stop working and if you haven't put in a button or someting to switch back from Modal you basically have to kill DataEase.

This is most likely how far you took it and then thought it is a crazy functionality. 

However, our user today obviously wanted to go down this route so we compiled a sample to show how you can get control of this "beast".

He wanted to have multiple forms open at the same time and switch between them via buttons but not allow the user to do it via Windows standard functionality.

So what we do is to open a "MainForm" that immediately switch to Modal.

When a form is in Modal is the entire "world". Nothing outside that form can impact the processing, so everything you want DataEase to do you need to do from a button etc. on this form. So if you switch to Modal without having a close button you have to "kill" dataease and start over.

So save, Delete, etc. need to be buttons or otherwise properties of each document you want to be modal.

We then have two forms Form1 and Form2 that will be opened on first "open" and then simply switched to when they are already open.

The problem is that we can't switch to a normal form from a Modal form so we do a hack.

SetCurrent("WindowClass","Normal")+if (GetCurrent("IsDocOpen","Form")="yes",SetCurrent("ActiveDoc","Form"), DocumentOpen("Form"))+wait(0.1)+SetCurrent("WIndowClass","Modal")

Magic is not real but it appear to be real and this is programming magic. As the goal is to stop the user and not the programmer from getting it "his" way, we simply switch off Modal, do our open form magic and then wait a moment before we switch back to Modal. This means that our Form1 is now the top modal form.

WHen we har done what we wanted in Form1 we simply do the same trick in reverse.

SetCurrent("WindowClass","Normal")+SetCurrent("ActiveDoc","MainForm")+wait(0.1)+SetCurrent("WindowClass","Modal")

Simples!

You can basically just remove Toolbars, Tabbar and filemenu etc as the user will simply be confused by them being there.

We have done that here. Removed all toolbars, catalog etc. and also the caption on each document. Here we use Normalized (Windowed) so you can see all the open forms at the same time but it will work as well with Maximized etc.

When doing it this way you have started from the opposite direction of normal DataEase so the problem is no longer that a user can close windows etc with close button, but rather that they can't do anything that you don't allow them to do ...and to be honest, that has been something a lot of you have been wishing for, for a long time - almost forever.


Written by DataEase 19/08/20 at 14:32:40 Dataease [{8}]FIVE
DG3_BlogList