Mail Archives: djgpp/1997/07/29/08:46:49
I have started playing with the GUI routines and I'm trying to write my own
button_proc, but it doesn't work as i want.
Here is the custom proc:
int my_button_proc(int msg, DIALOG *d, int c)
{
if (msg==MSG_DRAW)
{
button = (BITMAP *)gui_data[normal_button].dat;
blit(button, screen, 0, 0, d->x, d->y, button->w, button->h);
if ((d->flags & D_SELECTED) && (d->flags & D_GOTFOCUS) && (d->flags &
D_GOTMOUSE))
{
button = (BITMAP *)gui_data[pushed_button].dat;
blit(button, screen, 0, 0, d->x, d->y, button->w, button->h);
}
return D_O_K;
}
return d_button_proc(msg, d, c);
}
When i run this the button behaves kinda like a checkbox, when the mouse is
clicked over it it changes to the pushed_button bitmap. How do i make work
like a normal button, so that the pushed_button bmp is displayed when the
button is clicked and then when the button is released it will be
overwritten with the normal_button bmp?
/Daniel Mattsson
PS. Thanks to DJ Delorie and Shawn for an outstanding programming enviroment.
- Raw text -