delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/29/08:46:49

Message-Id: <3.0.32.19970729144506.00693058@m1.261.telia.com>
Date: Tue, 29 Jul 1997 14:45:12 +0200
To: djgpp AT delorie DOT com
From: Daniel Mattsson <daniel DOT mattsson AT gavle DOT mail DOT telia DOT com>
Subject: Allegro GUI Problem
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019