Make Subforms behave as a single screen
Roberto Ramirez Cervantes
Hello All,
In Magic, if you want to display a one-to-many relationship (i.e. an Order screen that displays Order Number, Customer Info, Order Date at the top of the screen and a table at the bottom displaying the Order Line items related to the current Order), the use of a SubForm control with the arguments that will ensure the information in the Order Line program\task are a match for the Order Header data is an easy one-step solution. If you run the program it is clear that these two programs\tasks look like a single screen, but if you try to use the <Tab> or <Shift+Tab> keys to go in or out of the Order Line fields you will either get "stuck" in the Order Line screen, you cursor will change direction, not park in the correct Order Line field or jump to an unexpected field in the Order Header screen, classic Magic behavior for one-to-many environment; not to mention that pressing the <Esc> key while in the Order Lines will park the cursor on the first field of the Order Header screen instead of closing the screen. Before I start implementing a solution for these issues by hand, is there a setting that I am missing right now or coming down the pipeline that will automatically make these two screens\programs\tasks REALLY behave as a single one? Thank you. Roberto
|
||||||||||||||
|
||||||||||||||
No such luck, Roberto.
toggle quoted messageShow quoted text
You're just going to have to handle all navigation keystrokes manually, control by control, by creating non-propagating Logic Units on events Next Field, Previous Field, etc., etc., etc., and raise other events in those handlers as needed to synthesize the navigation behavior you're looking for. Note that you may have to go so far as disabling Automatic Z- and/or Tab-Order — I'm sorry I don't remember the details. Before Magic introduced a real Tree Control, I synthesized the behavior of Windows Explorer (almost) exactly this way. It was a RPITA, but it worked. You might want to review my Drag-and-Drop, Multi-Mark demo. There's some similar event manipulation in there, specifically in the implementation of two, side-by-side List Boxes, like this in DDF Maker: Steven G. Blank Ξ SGBlank Consulting
On 5/19/2022 2:10 PM, Roberto Ramirez
Cervantes wrote:
Hello All,
|
||||||||||||||
|
||||||||||||||
Roberto Ramirez Cervantes
Thank you Steven,
I was afraid of that... it will be tedious work but I think it will be worth it to take out Magic's idiosyncrasies from these kind of programs\screens Roberto
|
||||||||||||||
|
||||||||||||||
It won't be so bad.
toggle quoted messageShow quoted text
In the table control, for example, you'll only have to intercept events on the first and last columns — in between, the default behavior should work as is — and upon entering and leaving the table(subform). Handle the exceptions. Expect it to be an iterative* process. Then expect your first actual user to promptly break it. ("Why did you hit THAT key?") ;) Steven G. Blank Ξ SGBlank Consulting *trial and error
On 5/19/2022 4:04 PM, Roberto Ramirez
Cervantes wrote:
Thank you Steven,
|
||||||||||||||
|
||||||||||||||
Roberto,
This is not that bad anymore.
Since a subform control is just another “control”, you can define the tabbing order in the header on when the cursor jumps into the subform. As you tab through the controls in the subform, and you want the control to return to the next field in the parent, you should just be able to raise an event on that control of “Exit” or “Quit” to return to the parent and should be on the next control after the subform control in the tab sequence.
If you don’t want to return to the next field, you can always issue a CtrlGoto (1,<control>) and the control you want the cursor to park on.
Keith
From: main@magicu-l.groups.io <main@magicu-l.groups.io> On Behalf Of Steven Blank
Sent: Thursday, May 19, 2022 9:27 PM To: main@magicu-l.groups.io Subject: Re: [magicu-l] Make Subforms behave as a single screen
It won't be so bad. Steven G. Blank On 5/19/2022 4:04 PM, Roberto Ramirez Cervantes wrote:
|
||||||||||||||
|
||||||||||||||
Todd Baremore
Roberto,
toggle quoted messageShow quoted text
In the Online Samples take a look at "SB06_Subform Tabbing OUT". It appears to demonstrate exactly what you need. Also in Online Samples is "TS19_Cascading Exit" which demonstrates how to exit a program from a subtask. Todd On 5/20/2022 6:17 AM, Keith Canniff
wrote:
|
||||||||||||||
|
||||||||||||||
Hi all,
somehow i delete my respond ... You can achieve this by creating and "Exit event" in parent task, set scope to subtask and set propagate to yes. Inside of this event raise event Quit (or exit ... quit also fires F2 i belive so you wont get stuck on any errors if you have controls on fields). Now pressing esc in subform, will close the whole form ... And for the exiting of subform back to parent form look at what Tood Baremore suggested. Regards, Adrian
|
||||||||||||||
|
||||||||||||||
Wes Hein
You can add a virtual logical field to the parent, pass to the subtask. Have the subtask set to true (only when the cursor actually reaches the subform - SubformExecMode(0)=0 in the task prefix of the subform). Do a Variable Change on the parent logical field
that triggers when it changes to true, then set back to false and do a ctrlgoto() call to put the cursor where you want
Wes
|
||||||||||||||
|