application.getApplicationType() for web client

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?

	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

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.

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:
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.

Try to use a different style on the login form, I think that if I style has already been “touched” it cannot be switched.

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.

Hmm, then I don’t know what’s happening, it works fine for me but I create the style on the fly like this:

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')

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?

Yes, it works fine for me

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:
Yes, it works fine for me

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

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:
Robert, you can only debug when starting the clients (web or smart) trough Servoy Developer. No matter the version.

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.

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:
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.