Top Menu Shortcuts and Keys.

Started by Elias Montoya, April 10, 2008, 11:49:37 PM

Previous topic - Next topic

Elias Montoya


Paul, when i add a Menu shortcut for an action, the controls stop receiving that
cobination of keys, for example, if i have a dialog with a menu with the shortcut CTRL+C,
the controls dont receive that combination of keys...

Why? Well, wheat i want is to capture the CTRL+C and do some actions on Egrid32 when
it is focused, but still be able to use CTRL+C in texboxes. But if add that shortcut, the textboxes
dont receive CTRL+C anymore.

Do you know a work around for this?

Marc van Cauwenberghe

Is it because ctrl-c is a standard Windows key command for Copy  ?

Elias Montoya

 Yes, thats the point. When i add CTRL+C as a menu shortcut,
i cant use CTRL+C to copy text from the textboxes.

I want to process CTRL+C only as a dialog command, not to
eliminate from ALL the controls.

TechSupport

Hi Elias,

I am not 100% sure that I understand what the problem is. If a TextBox has focus then you should be able to use the CTRL+C accelerator to copy text. If you choose your menu item for copy and the TextBox has focus then you will have to handle the copy yourself. In the case of a TextBox it is easy - you simply need to send a WM_COPY to the TextBox. See this example:

Function FORM1_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 zClassName As Asciiz * 100
   
   Select Case wID
      Case IDC_FORM1_MNUCOPY
         GetClassName GetFocus, zClassName, SizeOf(zClassName)
         If UCase$(zClassName) = "EDIT" Then
            SendMessage GetFocus, %WM_COPY, 0, 0
         End If
           
   End Select
     
End Function


So, I guess you could also check for the classname for your EGrid and then forward an applicable "copy" EGrid message to your EGRid control.

I hope this answers and solves your problem.

Elias Montoya