How to determine if the button is pressed or not in L4 Dope?
nf2 at inf.tu-dresden.de
Wed Jun 25 16:53:59 CEST 2008
> I am trying to write an application in L4 Dope.
> Right now, I face a problem. I need to determine if the button is pressed by
> user or not.
> In the dope-users-guide.txt, there is a function: dope_req() . I tried to
> use it to check the button event, but failed.
> Is anyone know the way to figure it out? Thanks a lot.
For handling button-press events, you need to associate the
event type you are interested in ("click" or "commit") to a
callback function via the DOpE API function 'dope_bind'.
This function is briefly described in dope-users-guide.txt
in section "Binding events to callback functions". In this
document, you will also find the event types provided by the
different widgets, for example button widgets support the
event types "click", "clack" and "commit".
You may also take a look at 'examples/vscrtest/vscrtest.c'.
At line 116 you find the following simple example:
dope_cmd(app_id, "exit = new Button(-text Exit)");
dope_cmd(app_id, "mg.place(exit, -column 1 -row 99)");
dope_bind(app_id, "exit", "commit", exit_callback, (void *)0);
This code creates an exit button, places the button into
a grid (mg) and associates the local C function 'exit_callback'
with "commit" events for this button. When the user now presses
the button, the registered function will be called and can react
upon the event.
More information about the l4-hackers