Thread: Commands with Menu

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    68

    Commands with Menu

    Hi,

    I've managed to get the pop up menu in my program

    however now I have to set commands to make it do things when I click on them.

    here is my code

    Code:
    case WM_MOUSEMOVE:
    			{
    				mouse_y = LOWORD(lParam);
    				mouse_x = HIWORD(lParam);
    			}
    		case WM_INITDIALOG:
    			{	
    				hMenu = LoadMenu(GetModuleHandle(NULL),//Load Menu
    				MAKEINTRESOURCE(IDR_MENU2));
    				hMenu = GetSubMenu(hMenu,0);//Get Sub Menu
    				return 1;
    			}
    				
    		case WM_RBUTTONDOWN:
    			{
    				point.x = LOWORD(lParam);//Get cursor Pos
    				point.y = HIWORD(lParam);
    				TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON,
    				point.x,point.y,NULL,hWnd,NULL);//Create popup
    				return 1;
    			}
    		case WM_LBUTTONDOWN:
    			{
    					case ID_COUCHCOLOR_RED:
    						{
    							couch couch2;
    							couch2.set_rgb(1.0, 0.0, 0.0);
    							couch2.draw();
    						}
    				
    			}
    the code works correctly when i right click but when I try to change the color it wouldn't work its WGL based program. I am trying to get the couch to change the color.

    I am thinkin hard

    Thx
    -Ti22-

  2. #2
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    nvm guys

    I got it to work
    -Ti22-

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    68
    Hey guys I just ran into a problem not sure how to fix this.

    Code:
    case WM_COMMAND:
    			{
    					
    				switch(LOWORD(wParam))
    				{
    					case ID_COUCHCOLOR_RED:
    						{
    							couchR = 1.0;
    							couchG = 0.0;
    							couchB = 0.0;
    							
    						}
    					case ID_COUCHCOLOR_WHITE:
    						{
    							couchR = 1.0;
    							couchG = 1.0;
    							couchB = 1.0;
    						}
    					case ID_COUCHCOLOR_BLUE:
    						{
    							couchR = 0.0;
    							couchG = 0.0;
    							couchB = 1.0;
    						}
    				}
    
    			}
    thats the code I am using to govern the color of the couch

    however when I click on the colors IE red it just uses the latest color, is there no way to stop this? it just applies the latest color.

    If I remove the Blue and White though I can get red color.
    -Ti22-

  4. #4
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Try not to cross post, most people here read all the forums. Read this . It is my response to your same question on the c++ board.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM