Mail Archives: djgpp/1997/05/12/13:39:58
Gary Cowell (QI'HoS) wrote:
>
> Hi..
>
> What I want to be able to do is have a button that does not 'stick', I
> just want the button to be 'filled' when the mouse button is down, but
> 'cleared' when it is released again.
>
> Any way of doing this? I can't find it in the allegro docs...
>
You have to define your own d_mybutton_proc() GUI procedure, instead of
using the default one. Here is how:
int d_mybutton_proc(int msg,DIALOG *d,int c)
{
int ret;
/* call the button as usual */
ret=d_button_proc(msg,d,0);
/* if it is selected, ie "black", then */
if(d->flags&D_SELECTED)
{
/* do whatever the button triggers: here is calls some function, in a
table, and wait for the mouse button to be released */
functable[d->d1]();
while(mouse_b);
/* deselect the button and redraw the button in white */
d->flags^=D_SELECTED;
show_mouse(NULL);
d_button_proc(MSG_DRAW,d,0);
show_mouse(screen);
}
return ret;
}
Hope this helps
Francois
- Raw text -