Title: Is it possible to open a group from one form inside another form? Post by: Bryce S. on February 28, 2008, 01:35:08 am Hi,
I've just started modifying old bds code to run with genero, adapting it to open much of its content within the main window/form of the program by hiding or unhiding of the form's groups (the old code would pop a fresh window to show the various content when selected). It looks really tidy using the form's groups in this way, but one of the functions is in a common module with it's own form. Is it possible, when I call this modules functions, to open a particular group from that modules form and have it display in my currently open form (instead of having to use that modules 'open window' and have a new window overlay my current form)? I guess in my .per file I want a group that is just a placeholder for the group from the module's form so it knows where to display, and to be able to tell it to open there instead of opening a new window (I don't want to clone the module's form into my existing form). Hope this makes sense :) Regards, Bryce Stenberg. Harness Racing New Zealand Inc. Title: Re: Is it possible to open a group from one form inside another form? Post by: Reuben B. on February 28, 2008, 05:34:38 am Hi, I've just started modifying old bds code to run with genero, adapting it to open much of its content within the main window/form of the program by hiding or unhiding of the form's groups (the old code would pop a fresh window to show the various content when selected). It looks really tidy using the form's groups in this way, but one of the functions is in a common module with it's own form. Is it possible, when I call this modules functions, to open a particular group from that modules form and have it display in my currently open form (instead of having to use that modules 'open window' and have a new window overlay my current form)? I guess in my .per file I want a group that is just a placeholder for the group from the module's form so it knows where to display, and to be able to tell it to open there instead of opening a new window (I don't want to clone the module's form into my existing form). Hope this makes sense :) Regards, Bryce Stenberg. Harness Racing New Zealand Inc. Bryce, I was curious when you said you were hiding/showing groups to replace the content in the main window. If you want to keep your .pers smaller and more maintainable you can use DISPLAY FORM to replace the current form in the current window with another form. Code
However I will add a disclaimer that the manual does at one point say "A program can load a Form file with the OPEN FORM instruction, then display the Form with DISPLAY FORM into the current window, and release resources with CLOSE FORM. However, it is recommended that you dedicate a window for each form. Programs typically create the window and load the form in a unique instruction: OPEN WINDOW WITH FORM." I don't know why it says that. You have also got the option of folder pages to get lots of content in one window rather than showing/hiding groups. Could I also ask why you don't want to open a window for a common routine and then close it when the user has finished the common routine (as per common_window in the above code) Reuben Title: Re: Is it possible to open a group from one form inside another form? Post by: . on February 28, 2008, 09:01:29 am However I will add a disclaimer that the manual does at one point say "A program can load a Form file with the OPEN FORM instruction, then display the Form with DISPLAY FORM into the current window, and release resources with CLOSE FORM. However, it is recommended that you dedicate a window for each form. Programs typically create the window and load the form in a unique instruction: OPEN WINDOW WITH FORM." I don't know why it says that. Actually, the main reason why we do not advice OPEN FORM DISPLAY FORM is the following: when you do several OPEN FORM / DISPLAY FORM, the previous form is simply hidden. Therefore, on the front-end side, you have all the forms, but only the last one is visible. And this could be heavy for GDC if your forms are pretty large - specially for Windows where USER/GDI Objects are limited by the system. Using a new window for each form gives you a visual hint: I see there are multiple windows, I see that my application is pretty large. If I use only one window with multiple forms, I may not understand why GDC is suffering while there is only one visible form. Of course, we could change the current implementation (remove hidden forms instead of hiding them for instance), but for now this is not the case. This is why we have this point in the doc. Title: Re: Is it possible to open a group from one form inside another form? Post by: Sebastien F. on February 28, 2008, 12:45:57 pm However I will add a disclaimer that the manual does at one point say "A program can load a Form file with the OPEN FORM instruction, then display the Form with DISPLAY FORM into the current window, and release resources with CLOSE FORM. However, it is recommended that you dedicate a window for each form. Programs typically create the window and load the form in a unique instruction: OPEN WINDOW WITH FORM." I don't know why it says that. Maybe this sentence is not clear... You are free to use one or more OPEN FORM / DISPLAY FORM in the same Window, or dedicate a new window for each form with OPEN WINDOW WITH FORM. Actually it depends if you are in the main window or in a temporary popup window. Typically, you do OPEN WINDOW WITH FORM to show a new (resizable) popup window to let the user select in a list of records. In this case the window must be dedicated to the form, and it's expected to have it appears at the top of the main (parent) window. For main (SCREEN) window, you are free to use one unique form or display several forms in cascade with OPEN FORM / DISPLAY FORM. Note also that in the past we suggested to close the SCREEN window at the beginning of the programs, but you can actually keep this default window and use OPEN FORM / DISPLAY FORM to show the main form. Seb Title: Re: Is it possible to open a group from one form inside another form? Post by: Leo S. on February 28, 2008, 12:49:14 pm One other reason why OPEN FORM/ DISPLAY FORM is hard to use for the moment is that unfortunately GDC doesn't adapt the window size if the 2nd form is much smaller than the previous one. This is especially annoying when trying to switch between a form containing a table and a form containing just labels and entries. But it's internally discussed to create a GDC window style which keeps track of the form size .
If the previous form is not used in an interaction(in the stack) it is *not* held at the GDC side, the VM destroys it. In general , having a way to do a similar thing to OPEN FORM/DISPLAY FORM inside a GROUP or FOLDER (or another placeholder one could define in the .per) would make much sense to me because it would prevent putting everything inside a large folder tabbed form and hence allow a more modular approach also in the forms. Kind Regards, Leo Title: Re: Is it possible to open a group from one form inside another form? Post by: Rene S. on February 28, 2008, 01:09:24 pm Hello,
just some technical background. Multiple OPEN FORM ... DISPLAY FROM will not DISPLAY all forms. What happens? Each FORM has a internal flag, if it's currently used by a screen interaction statement (INPUT, MENU, DISPLAY ARRAY, CONSTRUCT). If a form "b" is displayed over form "a" the runtime hides the form "a" if this form is attached by a dialog else it removes the form completely. Next example: GDC will see only one form. Code
Next example: When stating the second INPUT, the first INPUT is still active: the runtime will hide form_a. When returning to the first INPUT, form_b will be removed and form_a shown. Code
Display multiple FORMs in one WINDOW can be an interesting feature, to avoid too many inactive windows. Especially when migrating from TUI or BDL. Rene Title: Re: Is it possible to open a group from one form inside another form? Post by: Bryce S. on February 28, 2008, 08:53:12 pm Thanks for all the suggestions.
I know about the tabbed forms but I would end up hiding or unhiding the tabs instead of groups and still be in the same boat when I call the other module with its own window. I don't want to change forms, as the current one is already loaded with info. I just want to change the groups happening at bottom. Attached is some examples that may highlight what I'm meaning (using radio buttons in this form as choices change depending on person input, can remove or add appropriate radio options on the fly)... Attachment '1': starting view in form - user can pick function from radio buttons. Attachment '2': user picks 'driver details' function - radio button group hidden and details group shown (user returns to attachment '1' view when finished here). Attachment '3': user picks 'driver extension' function - again different group shows at bottom of form (user returns to attachment '1' view when finished here). Attachment '4': user picks 'employer' function - pop up window as from different module - how do I get it to open as a group in my existing form? I can live with it if it is not possible - just thought it would be nice (as in look better) if it opened in my current form by use of a place holder or something. Does what I'm trying to do have any relation to code or form 'snippets' - I think that was the term used at an introducing genero seminar I attended several years back, but memory very vague on that now. Regards, Bryce Stenberg Harness Racing New Zealand Inc. Title: Re: Is it possible to open a group from one form inside another form? Post by: Reuben B. on February 29, 2008, 03:44:11 am Quote Attached is some examples that may highlight what I'm meaning (using radio buttons in this form as choices change depending on person input, can remove or add appropriate radio options on the fly)... you can also add or remove buttons on the fly. However what you've done may have a benefit in terms of what code is executed when the user presses ENTER, or are you using ON CHANGE Quote Attachment '1': starting view in form - user can pick function from radio buttons. Attachment '2': user picks 'driver details' function - radio button group hidden and details group shown (user returns to attachment '1' view when finished here). Attachment '3': user picks 'driver extension' function - again different group shows at bottom of form (user returns to attachment '1' view when finished here). Attachment '4': user picks 'employer' function - pop up window as from different module - how do I get it to open as a group in my existing form? I can live with it if it is not possible - just thought it would be nice (as in look better) if it opened in my current form by use of a place holder or something. OK I can see what you are trying to achieve. A similar question was posed a year or two ago to do with folder pages but I can't find the post in the archives. That person wanted a common page to appear in many different folders. The only way I can think of involves a lot of typing and/or DOM Tree manipulation and may not lead to very maintainable code. Pre-processor isn't suitable for the contents of a LAYOUT section as its line by line. Quote Does what I'm trying to do have any relation to code or form 'snippets' - I think that was the term used at an introducing genero seminar I attended several years back, but memory very vague on that now. Snippets are to do with the Genero Web Client 2.1x |