Hello fellas ,
I am having trouble with defining user keys.
I created own function for keys
Code
private void userKeys()
{
//1. Create a user KeyBar
IUserKeyBar moje_tipke = getApplicationUI().createUserKeyBar("bedne so");
//2. create a reaction
IUserKeyListener poslusalec = new IUserKeyListener() {
@Override
public void onKeyEvent(IUserKey key, UserKeyEvent event) //only happens when button is actually pressed
{
if(flancna.getLED_green() == false)
{
flancna.setLED_green(true);
}
else
{
flancna.setLED_green(false);
}
}
};
//3. create a button
IUserKey gumbek = moje_tipke.addUserKey(0, poslusalec, true);
gumbek.setLED(UserKeyAlignment.BottomMiddle, UserKeyLED.Green, UserKeyLEDSize.Normal);
moje_tipke.publish();
//5. publish the keyBar
//pneumaticGripper.publish();
}
Display More
now here is the cache,
If i put this function in background service, and call it from "runCyclic", I can lode code to controller. Background service start automatically (green light) but also stops automatically after approx 1s. It's obvious that service is terminated.
but if I copy this same code to application and call this function and run it, it somehow WORKS
I'm using workstation 11
any suggestion what could couse the issue ?