Re: [AD] Check button bug

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]



Eric Botcazou wrote:
[snip]
> However, the doc is a little bit confusing:
> "This is an example of how you can derive objects from other objects. Most
> of the functionality comes from d_button_proc(), but it displays itself as a
> check box."
> It's all but clear that the w field is neither the width of the box nor the
> width of the widget itself !

Ok, here's a patch to fix this. Execpt it will break horribly if anyone
decides to derive anything from the checkbox, or change coordinates at
run time.

--
- Robert J Ohannessian

"Microsoft code is probably O(n^20)" (My CS teacher)
--- /allegro/src/guiproc.c	Sun Feb 18 18:39:10 2001
+++ allegro/src/guiproc.c	Sat Mar 24 16:25:32 2001
@@ -395,9 +395,15 @@
    int x;
    int fg, bg;
 
+	if (msg == MSG_START && !d->d1)
+      d->x += (d->h + text_length(font, d->dp) - d->w + text_height(font)/2);
+
    if (msg==MSG_DRAW) {
       int rtm;
 
+      if (!d->d1)
+         d->x -= (d->h + text_length(font, d->dp) - d->w + text_height(font)/2);
+
       fg = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
       bg = (d->bg < 0) ? gui_bg_color : d->bg;
 
@@ -417,6 +423,9 @@
 
       text_mode(rtm);
 
+      if (!d->d1)
+         d->x += (d->h + text_length(font, d->dp) - d->w + text_height(font)/2);
+
       return D_O_K;
    } 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/