|
Classes | |
class | RemoteGuiExample2 |
Brief description of class RemoteGuiExample2. More... | |
An example for how to use the remote gui framework for building simple user interfaces over ice.
Often, you want to allow simple user interactions with an ArmarX component, e.g. to tweak a parameter, enable a feature or visualization or trigger an action. Building a dedicated, full-blown gui plugin can be very tedious for simple cases. For this use case, ArmarX offers a remote gui framework for building user interfaces over ice.
This component demonstrates how to do this based on two examples:
To run the example:
RemoteGuiProvider
RemoteGui
RemoteGuiExample2
RemoteGui
widget.The scenario RemoteGuiTest
starts the necessary components, including the example component.
A component which wants to offer a remote gui needs to:
#include <ArmarXGui/libraries/ArmarXGuiComponentPlugins/LightweightRemoteGuiComponentPlugin.h>
armarx::LightweightRemoteGuiComponentPluginUser
armarx::RemoteGui::Client::Tab
in its onConnectComponent()
using RemoteGui_createTab()
onConnectComponent()
using RemoteGui_startRunningTask()
RemoteGui_update()
to process gui events (e.g. changed values, pressed buttons)RemoteGui_createTab()
can be called once by the component to create a tab in the RemoteGui
widget. In can be called again later to rebuild the tab, e.g. if the gui's structure should change.
RemoteGui_update()
is called by a processing thread at a regular interval. There, you can check the widgets for whether their value has changed (.hasValueChanged()
) or whether a button was pressed (.wasClicked()
).
Important note: RemoteGui_update()
is called from a separate thread, so you have to use synchronization mechanisms such as std::mutex
and std::scoped_lock
to synchronize access to variables which are accessed by different threads.