Menus not responding

Started by Gary Stout, September 03, 2015, 09:29:17 AM

Previous topic - Next topic

Gary Stout

Hello all,

I am still working on converting a large project from, EZ, and things are coming along very well! The main form has a menu with 3 main items and several sub items under each main menu item. I am just now getting to the point of adding the code behind the menu items. I noticed when I am running/testing the project, none of the menus items respond to the mouse hovering or clicking. I am not sure if I have disable some property that is causing this or what. I did try creating a new project with a menu for test purposes, and everything works fine there....so does anyone have any thoughts on what I may have done?

Thanks,
Gary

Eddy Van Esch

In your form that has the menu items, do you have a function simular to this, to respond to the menu item clicks?


Function MAIN_WM_COMMAND ( _
                         hWndForm     As Dword, _  ' handle of Form
                         hWndControl  As Dword, _  ' handle of Control
                         wNotifyCode  As Long,  _  ' notification code
                         wID          As Long   _  ' item, control, or accelerator identifer
                         ) As Long
    Local i As Long
   
    Select Case wID
        Case IDC_MAIN_MNUEXIT
            MsgBox "Menu item 1"
     
        Case IDC_MAIN_MNUHELP
            MsgBox "Menu item 2"

        Case IDC_MAIN_MNUABOUT
            MsgBox "Menu item 3"
           
    End Select

End Function
Eddy

Gary Stout

Eddy,

I do have similar code. In the menu editor, I clicked the "create select/case code" and pasted the code into the Main_WM_Command function. In my test program, I had none of this, yet the menus still functioned (even though there was no code for them to do anything). Its probably something I have done, but I sure haven't figured out what.

Thanks,
Gary

Eddy Van Esch

How about you make a copy of your project (files) and remove as much code as possible that is not related to the menu items.
If you have a 'skeleton' project, maybe it is easier to spot what is wrong ....
Eddy

Gary Stout

Ok, I think I found the problem....
The following code in the MainForm Custom event has the following to prevent the form from being moved or dragged. It seems that changing Function=1 to Function=0 solves the menu issue.
I hadn't noticed that the menus were not working until today, but I wasn't to the point of adding code until today.


   Select Case wMsg         
      Case %WM_NCHITTEST               
         Select Case DefWindowProc( hWndForm, wMsg, wParam, lParam)
            Case %HTSYSMENU, %HTMINBUTTON, %HTMAXBUTTON, %HTCLOSE  ' allow these
            Case Else   ' don't allow anything else   
               Function = 1
         End Select           
   End Select


Thanks again,
Gary