Page 1 of 1

Can't set first form back to none

PostPosted: Tue Mar 14, 2006 5:15 pm
by gstein
It seems that if in settings you set the First Form to a form and then later want to change it, you can change it to another form, but not back to none.

This is a problem for us because we turned on security and depending on who logs in we want to show them the right first form for them. We have the code working fine, but no matter what the code says, it seems the first form that is always opened is the form listed in the First Form setting.

Is there a way to turn that off?

PostPosted: Tue Mar 14, 2006 5:21 pm
by ROCLASI
You can select <none>. You find it all the way at the top of the combobox list. You might have to use the scrollbar.

Hope this helps.

PostPosted: Tue Mar 14, 2006 7:35 pm
by gstein
I know you can select none. The problem is it doesn't work. Once you have selected a form you can later change the first form to a different form, but if you change it back to none and then apply the changes and close the window the change doesn't stick. If you open the settings window again the form name is back in the First Form field rather than none.

PostPosted: Tue Mar 14, 2006 7:46 pm
by bcusick
If you specify "none" the application will open to the LAST FORM you viewed when in developer.

PostPosted: Tue Mar 14, 2006 7:59 pm
by gstein
Bob,

The problem is I can't set it to none. Every time I do it gets changed back to the form name. Please try this.

1. Open any solution.
2. Open the setting window. Set something in the First Form field if it isn't already there. Save the changes and close the window.
3. Open settings again and change the First Form to none. Save the changes and close the window.
4. Open settings again. If yours is working like mine, the First Form field will still have a form name in it rather than none.

PostPosted: Wed Mar 15, 2006 11:04 pm
by bcusick
Ummm... if you're programatically having a startup method - why don't you navigate to the right form in that method?

PostPosted: Wed Mar 15, 2006 11:52 pm
by gstein
Bob,

That is what I am doing, but its not working. The first form setting is over-riding the code.

Here is the code that is called from the On Open method of the solution:

Code: Select all
var p = security.getUserGroups(security.getUserId());
var myGroup = p.getValue(1,2);
if (myGroup == "Accounting") {
   forms.honoraria.controller.show()
}
else {
   forms.projects.controller.show()
}


The code is definately being activated and going to the right place, but the first form that is displayed is always the one in the First Form setting.

PostPosted: Thu Mar 16, 2006 10:52 am
by gstein
Bob,

It seems the only way to reset the First Form solution setting back to <none> is to do it on the repository directly:

delete from servoy_element_properties
where content_id = 245

I know we shouldn't be messing with the repository data directly, but in this case it seemed there was no other option -- and it seems to have worked fine.

Startup form

PostPosted: Tue Mar 21, 2006 8:03 pm
by kbleicken
I've been wrestling with the same problem. With a suggested direction from David Workman we have a work-around.

Create a new blank form called Startup, (or whatever) and create a method called Startup_method like this;

//pulls the client_id, user_id, and user permissions level
forms.clnt_cli_frm_1.clnt_login_get_userdata();

//depending on the client_id takes user to correct form
var clientId = globals.client_id
if ( clientId == 1 )
{
forms.clnt_admin_c3net.controller.show()
}
else
{
forms.cont_con_frm_contact.controller.show()
}

Which is identical to your code. Then choose the Startup as the first form and Startup_method as the On Open Method. Then also, (don't know why both, but is necessary) have Startup run Startup_method on show. This gets the desired result.

Hope this is helpful.

K

PostPosted: Tue Mar 21, 2006 10:16 pm
by gstein
Thanks, but it seems to me easier/simpler/better to remove the first form setting by running:

delete from servoy_element_properties
where content_id = 245

and then just have a startup method.

PostPosted: Tue Mar 28, 2006 9:39 pm
by Jan Aykroyd
Hi there

Any ideas on how to do this on OS X?

Thanks

PostPosted: Wed Mar 29, 2006 10:16 am
by gstein
OS X uses the same repository, so changing the value in the repository should work fine.

PostPosted: Wed Mar 29, 2006 12:09 pm
by Jan Aykroyd
Thanks for that, but I'm unclear on what file I should be adjusting exactly?

Thanks

Chris

PostPosted: Wed Mar 29, 2006 2:58 pm
by gstein
you have to execute the sql in the repository database -- the database which servoy uses to store all of its object information.

You can go to Edit/Preferences/DB Servers/repository_server/edit to see what DB you are using to store the repository information.