How to detect a click ANYWHERE on a Form?

Started by John Montenigro, September 10, 2006, 04:28:20 PM

Previous topic - Next topic

John Montenigro

My splash screen contains only one large label that almost fills the form. It stays visible for whatever time I set in my timer, then minimizes itself.

During that time, I want the user to be able to click anywhere on the form to make it minimize.

I see that the Form has WM_LBUTTONDOWN, but if the user clicks on the Label text, the Form doesn't see the click. And I don't see any click messages for the Label control.

I tried to push the label into a layer further "back" so that it gets drawn first and so that the background of the form can see any click, but that didn't work.

Any suggestions?

TechSupport

Quote from: John MontenigroI see that the Form has WM_LBUTTONDOWN, but if the user clicks on the Label text, the Form doesn't see the click. And I don't see any click messages for the Label control.
Labels have a WM_LBUTTONDOWN message. It is in the drop down Messages combo box with the rest of the messages. Also, you can respond to the STN_CLICKED message for a Label.

Function FORM1_LABEL1_STN_CLICKED ( _
                                 ControlIndex     As Long,  _  ' index in Control Array
                                 hWndForm         As Dword, _  ' handle of Form
                                 hWndControl      As Dword, _  ' handle of Control
                                 idStaticControl  As Long   _  ' identifier of static control
                                 ) As Long

  FF_CloseForm hWndForm

End Function


...or....



'------------------------------------------------------------------------------------------------------------------------
Function FORM1_LABEL1_WM_LBUTTONDOWN ( _
                                    ControlIndex  As Long,  _  ' index in Control Array
                                    hWndForm      As Dword, _  ' handle of Form
                                    hWndControl   As Dword, _  ' 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

  FF_CloseForm hWndForm

End Function

John Montenigro

Quote from: TechSupport
Quote from: John MontenigroI see that the Form has WM_LBUTTONDOWN, but if the user clicks on the Label text, the Form doesn't see the click. And I don't see any click messages for the Label control.
Labels have a WM_LBUTTONDOWN message. It is in the drop down Messages combo box with the rest of the messages.

I looked for any type of CLICKED messages before I posted the question, but I see no messages for Labels in any comboboxes!

The combobox on the left only offers me
  (General)
  frmSplash
  CustomControl1

but no sign of Label1, Label2, etc...

Whichever of the items in the left combobox that I select, the right combobox shows me the messages that each offers.

But since I can't see any Labels in the left combobox, I can't access their messages!

???I'm using FF v2.75 on WinXP with SP2

John Montenigro

Found it! In the editor settings, "Hide Label messages" was checked.

Turned it off, and everything is right in the world!