Modal and Modeless forms

Questions and answers for designing and implementing forms in Servoy

Modal and Modeless forms

Postby leokady1345842622 » Mon Sep 03, 2012 4:17 am

In my solution I have navigator form . This form is always attached to other forms(navigator property of form), similar like in servoy sample solution. Now , for example I call one of my form from navigator form. The form loaded in main window.After this I want to call same form again but in new window (as modal for example) by click on same button in my navigation form. The servoy load new instance of modal form with navigator form in new window ,but at same time remove navigator form in my main window where it was Mode-less form. Now, from my new modal window I call again same form and navigator form disappears again, but a new instance of modal form created with navigator form in new window.
If I put button on my running form and use it to call same procedure to run multiple instances of modal form the navigator form disappear only from first instance of modeless form which running first when solution open. How to run a same form multiple times when solution open? May be Servoy has a problem ?

Here the part of my code:
function showform1(_formname){
var win = application.getWindow();
var winTitle = win.title;
var nPosition = winTitle.indexOf(_formname);
if(nPosition>0){
//run second time as modal,checked by title name of window
var _sUniqueName = utils.stringReplace(application.getUUID().toString(), "-", ""); // fix for the window name, it doesn't handle '-' in the name
var lOk = application.createNewFormInstance(_formname, _sUniqueName);
if (lOk) {
var wind = application.createWindow(_sUniqueName, JSWindow.MODAL_DIALOG);
wind.title = project_title + " - " + _sUniqueName
wind.show(_sUniqueName);
}
}else forms[_formname].controller.show(); // run 1st time as modeless
}
Attachments
Modal and Modeless forms.pdf
Print screens of modal and modeless form
(308.16 KiB) Downloaded 289 times
leokady1345842622
 
Posts: 2
Joined: Fri Aug 24, 2012 11:10 pm

Re: Modal and Modeless forms

Postby omar » Fri Sep 07, 2012 10:12 am

Hi Leonid,

I tried to reproduce you problem but I do not have the same problem. What you should realize is that Servoy initializes all forms at startup (unlike VFP) and when you show a form all you do is make it visible and hide the other forms. However, in this case you used a command to actually create a new form instance which is not a problem but may not be the best approach in this case but I don't know that yet because I am not sure I understand what you are trying to achieve.

Normally different forms based on the same table will use the same underlying foundset which causes them to be in synch. If that's not what you want you can use a "seperate foundset" which is comparable to VFP's private datasession. Since you are using one form for two different activities I would suggest to actually define a second form and switch between them as desired. You could also use inheritance to define the similarities in the parent form and the differences in the subclasses (programming by exception).

Perhaps you can extract your problem into a small example solution and export it. That way I can get a better understanding of what is going wrong and help you from there.

Kind regards,
Intrasoft, Founder
Omar van Galen
omar@intrasoft.nl
+31-(0)6-21234586
Servoy Developer
omar
 
Posts: 377
Joined: Sat Feb 12, 2011 4:51 pm
Location: Intrasoft, The Netherlands

Re: Modal and Modeless forms

Postby leonid » Sat Sep 08, 2012 4:59 am

Hi Omar,
Thanks for your reply. I attach simple solution with this problem. On the left side you can see navigation form. If you click on the first two buttons the new form is loading in main apllication window w/o problem. If you click on the buttons 3 or 4 the same form loading as new instance in modal window , but the navigation form disappears from main aplication window. The navigation form was specified in navigator property of each form.
It seems servoy has a problem if different forms have same components (like navigation form). In our project we need to keep opened several forms at the same time and also we need to use same navigation buttons for all the forms. What is a best way to do it?
Best regards.
Attachments
modal_modeless1.servoy
solution created in 6.1.1
(6.59 KiB) Downloaded 277 times
Leonid,
Servoy / Foxpro / Java
leonid
 
Posts: 34
Joined: Wed Aug 29, 2012 1:58 am

Re: Modal and Modeless forms

Postby david » Sat Sep 08, 2012 8:36 am

You cannot show the same form more than once at the same time. Whether this is via multiple tab panels or in your case with different windows and the navigator pointing to the same form.

There are many ways to structure/program your solution so this doesn't happen. Some subtle, some not-so-subtle -- multiple window Servoy solutions require some expertise. If you're going it on your own I would recommend starting with never using the navigator (Servoy probably should have lobotomized it years ago like the tail on homo sapiens), check out loading forms into tab panels on the fly (the way to do navigation), and learn Solution Model coding (the brain on the aforementioned species).
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Modal and Modeless forms

Postby leonid » Mon Sep 10, 2012 1:20 am

Finally found the way how to show same form multiple time. The trick is - setup navigator to IGNORE on all other forms. Setup navigator only one time on the startup form. So, when you call model less form in main application window you can still use navigator ,when you call modal form navigator ignored.
Second solution , as David recommended generate navigator on fly and ignore this procedure when call modal forms.
I prefer 1st solution to use standard navigator property, but I cannot figure out how to show navigator in this case on right side of form. According servoy documentation the navigator is shown at the left or at the right side of the form, depending on the page orientation. I try with Defaultpageformat property and used 3 possible options for orientation: portrait,landscape ,reversed landscape, but it doesn't work. if somebody know how to do it?
Attachments
model_modeless_navonfly.servoy
Navigator generated on fly
(6.66 KiB) Downloaded 267 times
modal_modeless.servoy
used standard navigator property
(8.58 KiB) Downloaded 275 times
Leonid,
Servoy / Foxpro / Java
leonid
 
Posts: 34
Joined: Wed Aug 29, 2012 1:58 am


Return to Forms

Who is online

Users browsing this forum: No registered users and 5 guests

cron