Mail Archives: djgpp/1998/07/26/23:45:57
From: | brunobg AT geocities DOT com (Bruno Barberi Gnecco)
|
Newsgroups: | comp.lang.c,comp.os.msdos.djgpp
|
Subject: | Menus and mouse: how to tell what to do?
|
Date: | Sun, 26 Jul 1998 15:43:25 GMT
|
Organization: | UNINET (Unisys Brasil Internet Access Service)
|
Lines: | 19
|
Message-ID: | <35ba510b.361228@news.unisys.com.br>
|
NNTP-Posting-Host: | saopm01p21.unisys.com.br
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I'd like to know if it's possible to create and array of function names. For
instance, let's say that a menu has 5 options; if I could just detect what is the
chosen option (let's say, n), I could use the stored function name at the position
n, instead of a long switch. Or maybe, a more clever approach to solve this menu
problem... Actually, I have the same problem with the mouse.
What's the best way to tell the program: 'If you click here, do it', or 'If you
choose this option, do that'??? To handle the mouse hot-spots, I thought about
creating a struct like:
struct mousespot {
char minx, maxx, miny, maxy;
?function? // problem here
}
and check: if ( cursor < maxx && cursor > minx && cursor < maxy && cursor > miny
), but how to handle the function? Would a pointer to a function work? How to
declare it?
"There's never enough time to do all the nothing you want" Bill Watterson
Bruno Barberi Gnecco <brunobg AT geocities DOT com> ICQ #1383173 - PGP 5.0i user
My other OS is Linux -=- http://graphx.home.ml.org -=- Electric Eng, Poli
- Raw text -