A works-creen parameter is useful if you want to transfer information between screens. If you have a persons screen and it opens opens the contact screen, it would be useful to know the selected person in the contact screen. This is only one use-case another use-case could be that you control the layout of a screen. If you open a screen as popup, it could be useful to know that the screen is in popup mode.
If you want to set a work-screen parameter, you have two options:
1) set the parameter at custruction time
2) set the parameter at any time
An example:
//construction time IWorkScreen screen = getApplication().openWorkScreen("com.apps.demo.ContactWorkScreen", new Parameter("CONTACT_ID", rdb.getValue("ID"))); //later screen.setParameter("MODE_CONTACT", Boolean.TRUE);
It's also possible to listen on parameter changes in your work-screen:
eventParameterChanged().addListener(this, "doAnyParameterChanged"); eventParameterChanged("MODE_CONTACT").addListener(this, "doModeContactChanged"); public void doAnyParameterChanged(WorkScreen pScreen, String pParameter, Object pOldValue, Object pNewValue) throws Throwable { } //also possible //public void doModeContactChanged(WorkScreen pScreen, String pParameter, Object pOldValue, Object pNewValue) throws Throwable public void doModeContactChanged() throws Throwable { }
If you read a parameter from a work-screen, e.g.
screen.getParameter("APPMODE")
and the parameter was not found in the work-screen, then the parameter will be requested from the application. The application also has getParameter. If the parameter is not set in the application, the launcher will be used. This mechanism makes it possible for a screen to configure itself based on launcher, application or a screen parameter. For the screen it makes no difference where the parameter was set. But be careful because the event listeners only work if you register on the right component. It's not possible to register a listener for a parameter of a screen and expect a change event, if you set the parameter in the application.