-
Menu with the mouse
Hi there,
I am going to re-write some code that I did for the university, and I was thinking about including the mouse. For example, if I have a menu (with switch for example), will it mean a lot of work? Like in search of choosing option (1) I would click with the pointer on the option (1) New project.
It's just to know if it's worth, or it's too much for somebody with not too much experience.
Thanks for your comments
-
It depends on how well the 'get input' and 'do menu' are separated.
If they are hopelessly inter-twined, then it will be hard work.
If its a nice clean break, then another input routine (the mouse) should be fine, so long as the output it generates is the same as that from the keyboard.
-
Salem, thanks for your reply, but I don't really understand you.
This is one of the menu's I have done:
///////////////////////////////////////
void
MENU(void)
{
clrscr();
printf("\n\nPlease choose one of the following options: \n\n\n");
printf(" 1) Project menu\n");
printf(" 2) Materials library menu \n");
printf(" 3) Read instructions \n");
printf(" 4) Exit \n");
option = getch();
while (option>='1'||option<'5')
switch (option) {
case '1':
clrscr();
project();
break;
case '2':
clrscr();
materials_library();
break;
case '3':
clrscr();
instructions ();
break;
case '4':
clrscr();
EXIT ();
break;
default:
MENU();
break;
}
}
///////////////
And I'm using this compiler:
Turbo C++
Version 3.0
Borland International
Could you try to explain it again?
Thanks a lot
-
> option = getch();
Well this is something you want to hide inside a 'get_input' function (so you hide the fact that its coming from either the k/b or the mouse.
> default:
> MENU();
> break;
This isn't good - you could call yourself recursively indefinitely.
It's much better to use a while loop.
I wonder if you're up to function pointers?
-
i have a solution
hi gades,
do u want to select yr menu by clicking the mouse( as we r doing in GUI )? i have a solution of this job in graphics mode.
but i need to know yr requirements in details, then i'll try to solve yr problem.
-
Thanks for the replies, and sorry I didn't reply as well; but I didn't get an e-mail telling me that I had any other answers.
I've completelly changed my program, actually it's whole different program right now.
I'll post some of my questions later on.
Jackie: check your mail, and thanks.
-
i think that it can be with assembly .
with function 33h
Mov AX,FnNo
INT 33h
the are many functions for the mouse ....