Difference between revisions of "Sequencers"

From BlackBox Framework Wiki
Jump to: navigation, search
m (Hot to do something after view was closed?)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
== How to do something after view was closed? ==
  
 +
Robert Campbell
  
 +
TYPE
 +
CloseNotifier  =  POINTER TO RECORD (Sequencers.Notifier)
 +
plotId: INTEGER
 +
END;
 +
 +
PROCEDURE (c : CloseNotifier) Notify (VAR msg : Sequencers.Message);
 +
BEGIN
 +
WITH  msg : Sequencers.CloseMsg  DO
 +
###########
 +
ELSE END
 +
END Notify;
 +
...
 +
 +
VAR
 +
cNotif: CloseNotifier;
 +
BEGIN
 +
c  :=  Containers.Focus ();
 +
IF  c  #  NIL  THEN  c.GetFirstView (Containers.any, v)  END;
 +
 +
IF (v # NIL) & (v IS Plotters.View) THEN
 +
NEW (cNotif); cNotif.plotId := 1;
 +
v.Domain().GetSequencer()(Sequencers.Sequencer).InstallNotifier(cNotif)
 +
END;
  
Marco Ciot
+
== How to disable the window close? ==
  
TYPE
 
CloseNotifier = POINTER TO RECORD (Sequencers.Notifier) END;
 
  
PROCEDURE (n: CloseNotifier) Notify (VAR msg: Sequencers.Message);
+
Marco Ciot
VAR res: INTEGER;
+
BEGIN
+
WITH
+
| msg: Sequencers.CloseMsg DO
+
Dialog.Beep;
+
Dialog.GetOK("#Mondig:ATTENTION: Exit will stop data recording!!! Stop anyway? ", "", "", "", {Dialog.yes, Dialog.no, Dialog.cancel}, res);
+
IF ~(res = Dialog.yes) THEN
+
msg.sticky := TRUE;
+
END;
+
ELSE
+
END;
+
END Notify;
+
  
PROCEDURE MakeSticky*;
+
TYPE
VAR n: CloseNotifier;
+
CloseNotifier = POINTER TO RECORD (Sequencers.Notifier) END;
BEGIN
+
IF stickyDialog = NIL THEN
+
PROCEDURE (n: CloseNotifier) Notify (VAR msg: Sequencers.Message);
HostWindows.dir.minimized := TRUE;
+
VAR res: INTEGER;
HostWindows.dir.minimized := FALSE;
+
BEGIN
HostWindows.dir.l := 1100; HostWindows.dir.t := 600;
+
WITH
HostWindows.dir.r := 1400; HostWindows.dir.b := 900;
+
| msg: Sequencers.CloseMsg DO
StdApi.OpenAuxDialog('Mondata/Rsrc/HPM-Tool', '#Mondata:StorageForwarder', stickyDialog);
+
Dialog.Beep;
NEW(n);
+
Dialog.GetOK("#Mondig:ATTENTION: Exit will stop data recording!!! Stop anyway? ",
stickyDialog.Domain().GetSequencer()(Sequencers.Sequencer).InstallNotifier(n);
+
"", "", "", {Dialog.yes, Dialog.no, Dialog.cancel}, res);
END;
+
IF ~(res = Dialog.yes) THEN
END MakeSticky;
+
msg.sticky := TRUE;
 +
END;
 +
ELSE
 +
END;
 +
END Notify;
 +
 +
PROCEDURE MakeSticky*;
 +
VAR n: CloseNotifier;
 +
BEGIN
 +
IF stickyDialog = NIL THEN
 +
HostWindows.dir.minimized := TRUE;
 +
HostWindows.dir.minimized := FALSE;
 +
HostWindows.dir.l := 1100; HostWindows.dir.t := 600;
 +
HostWindows.dir.r := 1400; HostWindows.dir.b := 900;
 +
StdApi.OpenAuxDialog('Mondata/Rsrc/HPM-Tool', '#Mondata:StorageForwarder', stickyDialog);
 +
NEW(n);
 +
stickyDialog.Domain().GetSequencer()(Sequencers.Sequencer).InstallNotifier(n);
 +
END;
 +
END MakeSticky;

Latest revision as of 20:38, 28 March 2017

How to do something after view was closed?

Robert Campbell

TYPE
	CloseNotifier  =  POINTER TO RECORD (Sequencers.Notifier)
		plotId: INTEGER
	END;

	PROCEDURE (c : CloseNotifier) Notify (VAR msg : Sequencers.Message);
	BEGIN
		WITH  msg : Sequencers.CloseMsg  DO
			###########
		ELSE END
	END Notify;
...

VAR
	cNotif: CloseNotifier;
BEGIN
	c  :=  Containers.Focus ();
	IF  c  #  NIL  THEN  c.GetFirstView (Containers.any, v)  END;

	IF (v # NIL) & (v IS Plotters.View) THEN
		NEW (cNotif); cNotif.plotId := 1;
		v.Domain().GetSequencer()(Sequencers.Sequencer).InstallNotifier(cNotif)
	END;

How to disable the window close?

Marco Ciot

TYPE
	CloseNotifier = POINTER TO RECORD (Sequencers.Notifier) END;

	PROCEDURE (n: CloseNotifier) Notify (VAR msg: Sequencers.Message);
	VAR res: INTEGER;
	BEGIN
		WITH
		| msg: Sequencers.CloseMsg DO
			Dialog.Beep;
			Dialog.GetOK("#Mondig:ATTENTION: Exit will stop data recording!!! Stop anyway? ",
			 	"", "", "", {Dialog.yes, Dialog.no, Dialog.cancel}, res);
			IF ~(res = Dialog.yes) THEN
				msg.sticky := TRUE;
			END;
		ELSE
		END;
	END Notify;

	PROCEDURE MakeSticky*;
	VAR n: CloseNotifier;
	BEGIN
		IF stickyDialog = NIL THEN
			HostWindows.dir.minimized := TRUE;
			HostWindows.dir.minimized := FALSE;
			HostWindows.dir.l := 1100; HostWindows.dir.t := 600;
			HostWindows.dir.r := 1400; HostWindows.dir.b := 900;
			StdApi.OpenAuxDialog('Mondata/Rsrc/HPM-Tool', '#Mondata:StorageForwarder', stickyDialog);
			NEW(n);
			stickyDialog.Domain().GetSequencer()(Sequencers.Sequencer).InstallNotifier(n);
		END;
	END MakeSticky;