I have a problem with the headless client: some things I do a startup are not really useful in a HC (showing some start screen in a dialog etc.). Could we have a
application.isHeadless()
to figure out if the current client has a head or not?
exactly. And I can show you a log that is full of errors because I do things in my solution that are not good for a headless. So I try to prevent these problems.
Through the Servoy Plugin API, you can allready test if a connection to the server is a Developer or a Client and with some work if it’s a RunTime solution.
Maybe there’s allready a way to determine it’s a HeadLess client as well.
Haven’t done any work with the Headless Client myself, so haven’t looked at this, but maybe it’s possible in the API allready and just needs to be exposed through a plugin.
I am not sure this helps. My problems arise from the startup method. If I call my headless, I need methods, that are run after the startup method. I needed to pass that 1 to the startup method, but that is not the one I want to call…
Imo this helps because what you can do is this (btw I use this in one of my solutions from the beginning):
globals.headless = arguments[0];
if (globals.headless) {
//run the method(s) you need to run when the client is headless;
} else {
//run the method(s) you want/need to run when the client is a normal client;
}
The globals.headless variable is needed anyway if you make use of dialogs since you can not use these in a headless client anyway...
Ofcourse you can run this at the beginning of your startup method or at the end or, if that suits you better, from your first form that you open at the onShow or onLoad event.
I get your idea. This is just like application.isHeadless(). But what is your arguments[0] or where does it come from?
As I said before, my problems lay in the startup method. So when I call my JSP, the headles starts, runs the startup method and then comes to the method actually called. At what point now do I get a arguments[0] == true if I start a HC?
The Object array is (in my case) filled with the value 1. And now, your startup method can use that array named arguments. The first value in the variable can be accessed like you would access an array normally (arguments[0]) and holds that value 1.
Thanks, Marcel! I tested that and it looks like that works fine for me. So I can withdraw my feature request, since the feature is already available somehow.
The Object array is (in my case) filled with the value 1. And now, your startup method can use that array named arguments. The first value in the variable can be accessed like you would access an array normally (arguments[0]) and holds that value 1.
This is a FANTASTIC tip! Should be on Servoy Magazine!