delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/25/15:46:01

From: arrakyd <arrakyd AT club-internet DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with Allegro+GUI
Date: Wed, 25 Mar 1998 20:38:22 +0100
Organization: Grolier Interactive Europe
Lines: 86
Message-ID: <35195D2E.BFDEE450@club-internet.fr>
NNTP-Posting-Host: clermont-fd1-188.club-internet.fr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I need help!

I have a dialog with two buttons and a bitmap and I would like
the buttons to change the bitmap.

How can I do this ?

Here is what I'm trying to do:

int decr_proc(int msg, DIALOG *d, int c)
{
   int ret;

   /* call the parent object */
   ret = d_button_proc(msg, d, c);

   if (ret==D_CLOSE)
   {
      if (background_tile>0)
      {
         background_tile--;
         d[8].dp=tile[background_tile].image;
      }

      return D_REDRAW;
   }

   return ret;
}

int incr_proc(int msg, DIALOG *d, int c)
{
   int ret;

   /* call the parent object */
   ret = d_button_proc(msg, d, c);

   if (ret==D_CLOSE)
   {
      if (background_tile<255)
      {
         background_tile++;
         d[8].dp=tile[background_tile].image;
      }

      return D_REDRAW;
   }

   return ret;
}

DIALOG map_dialog1[]=
{
/* 0*/{ d_shadow_box_proc,    70,  60, 180, 80, 255, 0,   0,      0, 0,
0, NULL },
/* 1*/{ d_ctext_proc,        160,  62,   0,  0, 255, 0,   0,      0, 0,
0, "Map attributes -1"},
/* 2*/{ d_text_proc,          82,  80,   0,  0, 255, 0,   0,      0, 0,
0, "Map width" },
/* 3*/{ d_edit_proc,         180,  80,  32,  8, 255, 0,   0,      0, 3,
0, d_map_width },
/* 4*/{ d_text_proc,          82,  89,   0,  0, 255, 0,   0,      0, 0,
0, "Map height" },
/* 5*/{ d_edit_proc,         180,  89,  32,  8, 255, 0,   0,      0, 3,
0, d_map_height },
/* 6*/{ d_text_proc,          82,  98,   0,  0, 255, 0,   0,      0, 0,
0, "Background" },
/* 7*/{ decr_proc,           179,  98,  16, 16, 255, 0, '-', D_EXIT, 0,
0, "&-" },
/* 8*/{ d_bitmap_proc,       196,  98,  16, 16,   0, 0,   0,      0, 0,
0, NULL },
/* 9*/{ incr_proc,           212,  98,  16, 16, 255, 0, '+', D_EXIT, 0,
0, "&+" },
/*10*/{ d_button_proc,       135, 121,  50, 15, 255, 0,   0, D_EXIT, 0,
0, "&OK" },
/*11*/{ d_button_proc,       187, 121,  50, 15, 255, 0,   0, D_EXIT, 0,
0, "&Cancel" },
/*12*/{ NULL,                  0,   0,   0,  0,   0, 0,   0,      0, 0,
0, NULL }
};

When I do this, the dialog isn't redrawn. I must close it and open it
again
to make the bitmap change.


- Raw text -


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