Graphic button shortcuts?

Started by paulDiagnos, February 18, 2005, 09:06:03 AM

Previous topic - Next topic

paulDiagnos

Hi, the title speaks for itself this time

is there a fire fly function to be able to use shortcuts on graphic buttons.

text buttons are easy just put a & infrot of the button name, but would be nice to have same option on graphics.

thanks Paul

Roger Garstang

First thing that comes to mind is Keydown/up messages on the Form containing the button.  Check for key you want and the state of Ctrl/Alt/Shift that you want with it.  Just make sure it doesn't conflict with others.

This is a custom handler I use in a ListView, but Forms would respond the same way:


Function XPORT_FIELDLIST_CUSTOM (ControlIndex As Long, hWndForm As Dword, hWndControl As Dword, wMsg As Long, wParam As Dword, lParam As Long) As Long
Local itemCount As Long
Local ms_lvi As LV_ITEM

   Select Case wMsg
       Case %WM_KEYDOWN
           Select Case wParam
               Case %VK_F2
                   SendMessage(HWND_XPORT_FIELDLIST, %LVM_EDITLABEL, SendMessage(HWND_XPORT_FIELDLIST, %LVM_GETNEXTITEM, -1, %LVIS_FOCUSED), 0)
               Case %VK_DELETE
                   itemCount= SendMessage(HWND_XPORT_FIELDLIST, %LVM_GETNEXTITEM, -1, %LVIS_SELECTED)
                   Do While itemCount <> -1
                       Fields(itemCount).length= 0
                       SendMessage(HWND_XPORT_FIELDLIST, %LVM_UPDATE, itemCount, 0)
                       itemCount= SendMessage(HWND_XPORT_FIELDLIST, %LVM_GETNEXTITEM, itemCount, %LVIS_SELECTED)
                   Loop
                   Function= %TRUE
               Case %VK_A
                   If (GetKeyState(%VK_CONTROL) And &H8000)= &H8000 Then
                       For itemCount= 0 To SendMessage(HWND_XPORT_FIELDLIST, %LVM_GETITEMCOUNT, 0, 0) - 1
                           ms_lvi.stateMask = %LVIS_SELECTED
                           ms_lvi.State = %LVIS_SELECTED
                           SendMessage(HWND_XPORT_FIELDLIST, %LVM_SETITEMSTATE, itemCount, VarPtr(ms_lvi))
                       Next itemCount
                       Function = %TRUE
                   End If
           End Select
   End Select
End Function

paulDiagnos

Never Dissapointed from the response i get,
even after the amount of questions i ask

thanks Guys