• Welcome to PlanetSquires Forums.
 

Capture (shift or control) when button clicked.

Started by James Conforti, April 30, 2019, 05:56:08 AM

Previous topic - Next topic

James Conforti

FF3 on PB10

Here's what I'm trying to do (and I've tried searching and experimenting)...

Click a button "function 1"

Hold some "secret" key down (control or shift) and click button "function 2"

Button is located on a form that's assigned to a tab of a tab control on the main form if that matters.

Please, I can write all the technical PB there is, in just NOT a UI guy.

Paul Squires

It's been a while since I used Firefly but here are two different ways to handle this. The first is in BN_CLICKED and the second is via WM_LBUTTONUP. Choose one or the other depending on your needs. Hope this works for you.


'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_BN_CLICKED ( _
                                   ControlIndex     as Long, _      ' index in Control Array
                                   hWndForm         as HWnd, _      ' handle of Form
                                   hWndControl      as HWnd, _      ' handle of Control
                                   idButtonControl  as Long   _     ' identifier of button
                                   ) as Long

   If GetAsyncKeyState( VK_LCONTROL) And &H8000 Then
      MessageBox( 0, "BN_CLICKED: Control pressed", "Message", 0 )
   End If

   Function = 0   ' change according to your needs
End Function


'--------------------------------------------------------------------------------
Function FORM1_COMMAND1_WM_LBUTTONUP ( _
                                     ControlIndex  as Long,  _     ' index in Control Array
                                     hWndForm      as HWnd, _      ' handle of Form
                                     hWndControl   as HWnd, _      ' handle of Control
                                     MouseFlags    as Long,  _     ' virtual keys that are pressed
                                     xPos          as Long,  _     ' x-coordinate of cursor
                                     yPos          as Long   _     ' y-coordinate of cursor
                                     ) as Long

   If (MouseFlags And MK_CONTROL) = MK_CONTROL Then
      MessageBox( 0, "WM_LBUTTONUP: Control pressed", "Message", 0 )
   End If
   
   Function = 0   ' change according to your needs
End Function

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

James Conforti

Thanks much, Paul!  Works like a charm.  Sorry if my questions seem newb-ish, as I'm an experienced programmer (crypto, comms, automotive reprogramming, etc) but the graphic environment of windows escapes me.  Things like changing tool tips programmatically, adding buttons programmatically, etc.  (think dynamic interface).  Is there somewhere I can bug people about these issues - I still use FF3 (I actually just started using it) and PB10 as it works for me and I have literally a grundle of libraries that I choose to NEVER write again ;-) )

Petrus Vorster

Hi James

Best is to post it here.
The PB Forums everywhere had died.

There are still a few of us on FF3 and PB10, however at some point soon I will also move to WINFBE and FreeBasic.
Ask your hearts desire. Sometimes if we know, someone will still have code and Paul is always willing to help.

I still ask a lot of questions, and i still get a lot of help.

-regards Peter
-Regards
Peter