issue-#93 Opening a Form with a Tab View

Merged to the master branch
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

issue-#93 Opening a Form with a Tab View

Post by Robert »

I used to have a problem if I opened a Form containing a Tab view with the menu entries File -> Open Aux... or Open Tool... . It used to write a spurious error report to the Log.

I fixed this in my private installation. Can someone tell me if this error still persists in the current development version?

If the error is still there I will post my solution (1 line).


There is a related issue with the same routine - StdApi.ThisMask.
When you open (using OpenAux for example) a Form it is automatically converted from Layout mode to Mask mode which is a real convenience. However Forms on the Tabs of a Tab View in a Form are not converted. I have modified (10 lines) ThisMask to also convert these sub Forms which I find very helpful. If anyone is interested I will also post that.

(It converts the first level Forms, it does not recursively convert Forms on Tabs on Forms on Tabs on Forms - that did not seem really necessary!)

Regards
Robert
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: Opening a Form with a Tab View

Post by Zinn »

Robert wrote: I fixed this in my private installation. Can someone tell me if this error still persists in the current development version?
Yes, the error still exist. If you would like to have the fix in our version, please send your solution.
- Helmut
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Opening a Form with a Tab View

Post by Robert »

The "bug" fix is the single line (orange) "| v: StdTabViews.View DO". The extended convert Tabs to mask mode is in green.
The second listing is the same as the first, but with colours.

Since changing the mode of Tab Views is a bit inconvenient and sometimes needs to be done frequently in development I recommend adopting this change.

Code: Select all

	PROCEDURE ThisMask (param: ARRAY OF CHAR): Views.View;
		VAR v, tv, w: Views.View; c: Containers.Controller; rd: FormModels.Reader; k: INTEGER; label: Dialog.String;
	BEGIN
		v := ThisDialog(param);
		IF v # NIL THEN
			WITH v: Containers.View DO
				c := v.ThisController();
				IF c # NIL THEN
					c.SetOpts(c.opts - {Containers.noFocus} + {Containers.noCaret, Containers.noSelection});
					WITH c: FormControllers.Controller DO
						rd := c.form.NewReader (rd);
						LOOP
							rd.ReadView (tv);
							IF tv = NIL THEN EXIT END;
							WITH tv: StdTabViews.View DO
								FOR k := 0 TO tv.NofTabs() - 1 DO
									tv.GetItem(k, label, w);
									WITH w: Containers.View DO
										w.ThisController ().SetOpts(c.opts - {Containers.noFocus} + {Containers.noSelection,
											Containers.noCaret})
									ELSE
									END
								END
							ELSE
							END
						END
					ELSE
					END
				ELSE Dialog.ShowMsg("#System:NotEditable")
				END
			|	v: StdTabViews.View DO
			ELSE Dialog.ShowMsg("#System:ContainerExpected")
			END
		END;
		RETURN v
	END ThisMask;

Code: Select all

StdCoder.Decode ..,, ..RY....3Qw7uP5PRPPNR9Rbf9b8R79FTvMf1GomCrlAy2xhX,Cb2x
 hXhC6FU1xhiZiVBhihgmRiioedhgrZcZRiXFfaqmSrtuGfa4700zdGrr8rmCLLCJuyKtYcZRiX
 7.2.s,ccF.,k,5TWyql.bnayKmKKqGomC5XzET1.PuP.MHT9N9ntumaU2,CJuyKtQC98P9PP7O
 NbXmb.2.2y5k2EoT.,6.,U08J99SdfJHPNjvQCJuGKfaqmY6MwdONl1QCh0708T,U..w.Im5U.
 2U18J99SqorGqmQCbWBxhYFWUl1UnNHEWUmr.6.Yn3k52.dQ,2U.2.Ie,U00.bnUGLu8ro8quG
 rmCLWKqtE0E.kHE.0.p.0.4.0EJYjyC.6.VQ.kUk.8Mtr.0E.696.c4E.2k.F.c8.2UE0K.w2I
 U0KyB.,U33.2.e,2Uzvz6.,c8.2UE04E.M.l,,Msc.9.16z1U0A.2UuU1Ikmj,6.Y32.I12U.w
 z.460.J,U.2G2.l.,MF6,3gwP.,6..EBU.U,2.I3.0ES9.o.c2szH6IZuH5OF7OJZOF,7JFPOb
 PH1vQL96F7Q1fQ1PPp761eIZOEn86TeF,tEFOEZO8p76hOO9nt.rN1HM0hOEZ86h99,7Rh99,t
 Rp76hOOQCkR0mleHECoruKuUmlVyKrGLtyKqmqm8rR0GtGKR0GXyKtqqayKmUGhgVZgZJivsOp
 76HeHdOFDOFZuC,7P1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,6.0kXat.wnjl.k.E.0.3gwP.0..I16.M.E
 J2wAC.6.VQ.E..YVsH4E1LShwwkI73Qw70.5uP..202..E2E.U76.YiRRC,t75J.nT32kwL,dD
 MFHEfGA,UT....
 --- end of encoding ---
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: Opening a Form with a Tab View

Post by Zinn »

Robert, your solution add in StdApi the import of FormController, FormModel and StdTabViews.
That introduced a new problem: The module StdApi is compiled before this 3 modules compiled in the Build-Tool.
- Helmut
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: Opening a Form with a Tab View

Post by Josef Templ »

Robert wrote:I used to have a problem if I opened a Form containing a Tab view with the menu entries File -> Open Aux... or Open Tool... . It used to write a spurious error report to the Log.

What exactly are you talking about?
I cannot find such commands.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Opening a Form with a Tab View

Post by Robert »

Zinn wrote:Robert, your solution add in StdApi the import of FormController, FormModel and StdTabViews.
That introduced a new problem: The module StdApi is compiled before this 3 modules compiled in the Build-Tool.
- Helmut
Ok. I had not noticed this. Probably, for this reason, people will not think any benefit worth the significant change from the natural module import order.
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Opening a Form with a Tab View

Post by Robert »

Josef Templ wrote:What exactly are you talking about?
I cannot find such commands.- Josef
Apologies - I added some Commands to my Menus so long ago I had completely forgotten they were not standard!

However the problem still exists, even if it is less likely to be found than I realised.

If you call StdCmds.OpenAuxDialog it calls StdApi.OpenAux which calls StdApi.ThisMask.
If the file simply contains a Tab View an unnecessary error message is printed to the Log.

The same happens with OpenToolDialog.

The fix is to add the line

Code: Select all

|	v: StdTabViews.View DO
just before "ContainerExpected" in the procedure StdApi.ThisMask

Robert
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: Opening a Form with a Tab View

Post by Zinn »

Robert, I figure out that the reorder of the compile list is no problem.
This is the new order:
... StdDialog FormModels FormViews FormControllers StdTabViews StdApi ...
- Helmut
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: Opening a Form with a Tab View

Post by Ivan Denisov »

Robert, please, give the information, how I can reproduce the error?
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Opening a Form with a Tab View

Post by Robert »

Ivan Denisov wrote:Robert, please, give the information, how I can reproduce the error?
1 - Use the Controls Menu to create a new empty Form.
2 - Use the Controls Menu to insert a Tab View.
3 - Save this Window as 'D:\BlackBox\Priv\Rsrc\Form.odc', or whatever you like!
4 - Drag the Tab View onto the desktop to create a new Window.
5 - Save this (new) Window as 'D:\BlackBox\Priv\Rsrc\Tab.odc', or whatever you like!
6 - Close both Windows.

Now try the Commands below:
<Ctrl> Q "StdCmds.OpenAuxDialog ('D:\BlackBox\Priv\Rsrc\Tab.odc','Tab View')"
<Ctrl> Q "StdCmds.OpenAuxDialog ('D:\BlackBox\Priv\Rsrc\Form.odc','Form View')"

The first puts the unnecessary error message "container expected" into the Log.
The second fails to convert the Tab to Mask mode.

The version of StdApi.ThisMask below fixes both issues.

Code: Select all

PROCEDURE ThisMask (param: ARRAY OF CHAR): Views.View;
		VAR v, tv, w: Views.View; c: Containers.Controller; rd: FormModels.Reader; k: INTEGER; label: Dialog.String;
	BEGIN
		v := ThisDialog(param);
		IF v # NIL THEN
			WITH v: Containers.View DO
				c := v.ThisController();
				IF c # NIL THEN
					c.SetOpts(c.opts - {Containers.noFocus} + {Containers.noCaret, Containers.noSelection});
					WITH c: FormControllers.Controller DO
						rd := c.form.NewReader (rd);
						LOOP
							rd.ReadView (tv);
							IF tv = NIL THEN EXIT END;
							WITH tv: StdTabViews.View DO
								FOR k := 0 TO tv.NofTabs() - 1 DO
									tv.GetItem(k, label, w);
									WITH w: Containers.View DO
										w.ThisController ().SetOpts(c.opts - {Containers.noFocus} + {Containers.noSelection,
											Containers.noCaret})
									ELSE
									END
								END
							ELSE
							END
						END
					ELSE
					END
				ELSE Dialog.ShowMsg("#System:NotEditable")
				END
			|	v: StdTabViews.View DO
			ELSE Dialog.ShowMsg("#System:ContainerExpected")
			END
		END;
		RETURN v
	END ThisMask
Post Reply