Sub dialogs and parameter passing 2

From: Erik Spaans <"Erik>
Date: Wed, 2 Jul 2003 23:44:45 +0200

Hello,

Thanks Gerard, I'm a little new to all this. I get the idea about non-modal
programming: once started, each dialog proces should continue autonomously
from the one in which it was spawned.

I have some questions (to anyone):

1. I did not understand TabMult. How do I pass parameters to the new dialog
(rather to the module behind it)? I take it I first I have to start the new
dialog (using StdCmds) and only then pass the parameters. I can think of 2
ways:
- Sending a message to the new dialog module (by calling one of it's
methods)
- Using an exported global variable, as follows

MODULE ExMatrix;
IMPORT StdCmds;
TYPE NAME* = ARRAY 20 OF CHAR;
VAR
name* : NAME; (* PARAMETER TO BE PASSED *)

PROCEDURE Do*;
BEGIN
name := 'ERIK'; (* VALUE OF PARAMETER TO BE PASSED *)
StdCmds.OpenAuxDialog('D:/BlackBox/Ex/Rsrc/NeoUi',''); (* RESOURCE
FILE of NEO *)
END Do;

END ExMatrix.
<commander>ExMatrix.Do


MODULE ExNeo;
IMPORT Dialog,StdCmds,ExMatrix;
VAR
Dlg* : RECORD
Name- : ARRAY 20 OF CHAR; (* Read only value passed as
parameter *)
Address* : ARRAY 32 OF CHAR;
City* : ARRAY 20 OF CHAR;
END;

PROCEDURE Accept*;
BEGIN
(* Accept processing code here *)
StdCmds.CloseDialog;
END Accept;

BEGIN
Dlg.Name := ExMatrix.selectname$; (* PARAMETER PICKED UP AT
INITIALISATION *)
END ExNeo.

It works, but passing parameters as exported global variables seems a bit
strange. Am I right that using the first method is more correct?


2. How do I handle 'guises':

For example.
Module Matrix displays a dialog with a tree control with names and with
command buttons like AddSibling. AddChild, Update, Delete, DisplayDetails
etc.
Module Neo allows you to add, display, edit etc. the details (name, address,
city, date of birth etc).

On pressing any one of these Matrix command buttons this new seperate Neo
dialog appears (in slightly different guises): with AddChild or AddSibling a
new name can be entered (i.e. Dlg.Name*), but not with Update (Dlg.Name-);
with Delete all fields would be uneditable plus a message if deleting is
really intended. The names of the Neo captions and possibly command buttons
would be different too.

I presume I do not need a number of slightly different Neo modules, but can
direct / control the appearance & behaviour of Neo with some parameters from
Matrix.

Using Guard commnds I can activate or deactivate the Neo command buttons,
but how do I activate / deactivate, even display or not display the Neo
fields, and change them from editable to read only and back, plus change the
captions according to which operation was pressed in Matrix?


3. Matrix & Neo continue their seperate ways non-modally. That's fine if
from the first Neo has no more to do with Matrix (e.g. Neo updates a
database). But what if they are more tightly wound up with each other? In
the above case on succesful database update by Neo, the Matrix would need to
update it's list. Either Neo would the directly send Matrix a message on
completion (by calling for example a Matrix UpdateTree procedure). Or Neo
would update a status variable somewhere, which Matrix could poll, but then
it's more like modal programming again.

Is this right?


4. The whole thing is probably a lot simpler if they are not implemented as
seperate dialogs. Still that would mean first displaying the dialog with
just a tree control, and then later adding (superimposing?) the Name dialog
next to it within the same view.
My first impression is that this way is not really the right way as these
are seperate matters and therefore should use seperate dialogs. Is that
correct? But if I did this how do I do that (is that an example of a
wrapper)?

Quite a few questions, I hope someone will answer them. I could not find
much help in the documentation.

Erik
 






Received on Wed Jul 02 2003 - 23:44:45 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:09 UTC