2008/6/25 Norman Feske <nf2@inf.tu-dresden.de>:
Hello,

> 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.

Best regards
Norman

Hi Norman and all,

Thanks for your advice. I already read dope-users-guide.txt and vscrtest.c and use button event. The application uses ffmpeg to watch video in L4 dope.

Right now, I am writing the pause function but there is a button problem occurred. The sequence is that user presses play button and a new window pop out with video and two buttons (pause, exit) in it. When the video is shown, the pause or exit button event doesn't work until the video finished. Because I use while loop to read the video frame after set up the window, the button event have to wait for the while loop finished. 

I have tried using thread to synchronize the event but I failed. Now, I try to find out the way to  determine if the button is pressed or not and put the if conditional within while loop. Or maybe I was wrong. Does anyone know how to solve it? Thanks.

Best regards,
Lynette