[AGDev-newbies] enter key question

Thomas Ward tward1978 at earthlink.net
Wed Jun 14 21:47:26 BST 2006


Hi, Richard.
Generally, speaking you check for key presses using a switch statement.

switch(key)
{
case Key_Enter:
// do something.
break;

However, it is also possible to do it using an if statement.
}




Richard Bennett wrote:
> Ok listers, here is a good question that I am not sure of the answer 
> and what to be sure. The question is do I put a while not enter key or 
> do I use another if statement here and where do I put it and how? It 
> is a portion of a menu that Tom has sent me before. Here is the code. 
> what I want is if they hit the enter key on "yes" then they will go to 
> the yes module, but I am not sure if I would use:
> "while(!key[KEY_ENTER])"
> or if I would use:
> "if(key[KEY_ENTER]) instead and where exactly would I put this before 
> the first "if" statement here or what? Sorry if this is a stupid 
> question, but I just can't figure it out. Or should I use some other 
> type of statement. By the Way, I am doing this in C++. Thanks for the 
> help guys.
>
> void SelectMenuOption()
>
> {
>
> if(gMenu == gAnswer)
>
> {
>
> if(gLocation == 1)
>
> {
>
> Yes();
>
> }
>
> if(gLocation == 2)
>
> {
>
> No();
>
> }
>
> }
>
> }
>
> Richard Bennett *BEAN*
> Georgia State Phi Beta Lambda(PBL) Secretary
> personal e-mail:
> rbennett at southlink.us <mailto:rbennett at southlink.us>
> Windows Messenger(or MSN messenger):
> ichabodsparrow at hotmail.com <mailto:ichabodsparrow at hotmail.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> AGDev-newbies mailing list
> AGDev-newbies at lists.agdev.org
> http://lists.agdev.org/cgi-bin/mailman/listinfo/agdev-newbies
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 6/9/2006
>   



More information about the AGDev-newbies mailing list