PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Elias Montoya on April 10, 2008, 11:49:37 PM

Title: Top Menu Shortcuts and Keys.
Post by: Elias Montoya on April 10, 2008, 11:49:37 PM

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?
Title: Re: Top Menu Shortcuts and Keys.
Post by: Marc van Cauwenberghe on April 12, 2008, 08:23:54 AM
Is it because ctrl-c is a standard Windows key command for Copy  ?
Title: Re: Top Menu Shortcuts and Keys.
Post by: Elias Montoya on April 12, 2008, 05:21:10 PM
 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.
Title: Re: Top Menu Shortcuts and Keys.
Post by: TechSupport on April 12, 2008, 06:21:28 PM
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.
Title: Re: Top Menu Shortcuts and Keys.
Post by: Elias Montoya on April 14, 2008, 04:26:46 PM

Yes. That worked. Thanx paul. :)