RE: [AD] Alert function.

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


It all depends on how you want them spaced... and if they're all the same width... etc.
 
For n buttons of the same width, w, space, s, and buttons centered around the dialog center,
 
bs = n*w + (n-1)*s // Space required for buttons
if( bs < dialogWidth )
{
    x(0) = (dialogWidth - bs)/2;
    for i = 1 to n-1;
        x(i) = x(0) + i*(w + s);
}
else
    // No room
 
I'm sure that they're plenty of other ways to do this...
Good luck.
Ed Huonder


From: alleg-developers-admin@xxxxxxxxxx [mailto:alleg-developers-admin@xxxxxxxxxx] On Behalf Of Dustin Dettmer
Sent: Monday, December 05, 2005 4:13 PM
To: alleg-developers
Subject: [AD] Alert function.

I've rewritten the alert function adding in some new functionality and I'm trying to figure out how to align the x axis of the buttons.  The new system has a variable number of buttons, so the solution to my problem cant be solved the same way (that and I can't understand how the old alert3 function did it).

Attached is a picture of the alert dialog (poorly handdrawn).  I need to calculate the two blue points.  Their y position is easy, but how do I find its x?

Any advice at all or links would be helpfull

Thanks,
Dustin Dettmer


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