Page 1 of 1

application.getApplicationType() for web client

PostPosted: Mon Jul 22, 2013 2:49 pm
by huber
Hi Servoy Web Developers

I use following code to get the appropriate style sheet loaded, but if I start the browser, the _7rWeb style is not taken. The code is on the onOpen() method of the main module (property normal). Any idea?

Code: Select all
   if (application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT) {
      application.overrideStyle('_7rMac', '_7rWeb');
      ...
   }
   else if (application.getApplicationType() == APPLICATION_TYPES.SMART_CLIENT) {   
      ...
   }


Best regards, Robert

Servoy 5.2.16
OS X 10.8.4
Java 1.6.0_51
Safari 6.0.5

Re: application.getApplicationType() for web client

PostPosted: Mon Jul 22, 2013 3:29 pm
by ngervasi
That should work, make sure that you didn't use that style in the login form, that could prevent the override if I remember correctly.

Re: application.getApplicationType() for web client

PostPosted: Mon Jul 22, 2013 4:01 pm
by huber
Hi Nicola

I have the _7rMac (style) set for the Login form property styleName. I changed it for a test to Default, but it still doesn't work.
I am not sure which style you mean shouldn't be used on the Login form?

Robert

ngervasi wrote:That should work, make sure that you didn't use that style in the login form, that could prevent the override if I remember correctly.

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 11:33 am
by ngervasi
Try to use a different style on the login form, I think that if I style has already been "touched" it cannot be switched.

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 12:21 pm
by huber
Used another style than _7rMac on the Login form, but still the same result, i. e. does not use the desired _7rWeb style(sheet). I also can't debug, as the debugger does not stop on a breakpoint with the Web Client. It does stop on breakpoints when using the Smart Client.

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 1:08 pm
by ngervasi
Hmm, then I don't know what's happening, it works fine for me but I create the style on the fly like this:
Code: Select all
if(globals.gui_settings.style_name)
      {
         solutionModel.newStyle(globals.gui_settings.style_name, globals.gui_settings.style_code)
         // Override the default style
         application.overrideStyle('sintpro2008',globals.gui_settings.style_name)
         application.output('Using style: '+ globals.gui_settings.style_name,LOGGINGLEVEL.DEBUG)
      } else application.output('Using default framework style')

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 3:22 pm
by huber
Thanks Nicola, I hope someone using the "static" code jumps in to say if it works.
BTW, can you debug a web client setting breakpoints and the debugger stops at them?

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 3:29 pm
by ngervasi
Yes, it works fine for me

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 3:36 pm
by huber
What Servoy Developer version are you using? Can you also debug when the Servoy application server is on a server or only local on the same machine?

ngervasi wrote:Yes, it works fine for me

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 4:06 pm
by ngervasi
Robert, you can only debug when starting the clients (web or smart) trough Servoy Developer. No matter the version.

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 4:47 pm
by huber
I start the web client from Servoy Developer, but wherever I set a breakpoint, the debugger does not stop. No idea what the problem could be. I also do not get any application.output() message displayed in the Eclipse Console (tab). Hmmm.

ngervasi wrote:Robert, you can only debug when starting the clients (web or smart) trough Servoy Developer. No matter the version.

Re: application.getApplicationType() for web client

PostPosted: Tue Jul 23, 2013 4:55 pm
by ngervasi
That happens sometimes on mac after developer has been running for a while. Restart developer and as the first thing start a smart client, dunno why but that helps a lot.

Re: application.getApplicationType() for web client

PostPosted: Wed Jul 24, 2013 1:02 pm
by huber
I found the reason why the debugger did not work. I am starting via the launchctl mechanism the application server (java process). This is not a problem for the Smart Client debugger, but the debugger does not work under this circumstances in the Web Client. May be there is a technical reason for that (Servoy?).
The application.overrideStyle() problem is also solved. The command was not executed, as the method got quit before that statement because of a plugin.dialog error.
Thanks for all the suggestions which led me at last to try what was the problem, i. e. deactivating the automatic startup of the application server.

ngervasi wrote:That happens sometimes on mac after developer has been running for a while. Restart developer and as the first thing start a smart client, dunno why but that helps a lot.