FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour mouse - dialog
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
mouse - dialog
Posted: Tue Nov 13, 2012 09:33 PM

To all,
I need to see if the mouse is within my dialog box. If it's outside, then I need to take actions (end dialog).

Best regards,
Otto

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: mouse - dialog
Posted: Tue Nov 13, 2012 11:17 PM
Otto,

I think, it will give You the basics. Activate any of the Mouse-events You need.

Code (fw): Select all Collapse
// Testing the Mouse events

#include "FiveWin.ch"

static oWnd, oDlg

//----------------------------------------------------------------------------//

function Main()

DEFINE WINDOW oWnd FROM 100, 100 To 500, 800 PIXEL TITLE "Testing the Mouse"

oWnd:bLClicked    = { | nRow, nCol, nFlags |  IIF( nRow < oDlg:nTop() .or. ;
          nRow > oDlg:nBottom() .or. ;
          nCol > oDlg:nRight() .or. ;
          nCol < oDlg:nLeft(), oDlg:End(), NIL ) }

oWnd:bLButtonUp   = { | nRow, nCol, nFl8ags | oWnd:Say( 2, 2, "LButtonUp    " ) }

oWnd:bMButtonDown = { | nRow, nCol, nFlags | oWnd:Say( 2, 2,  "MButtonDown" ) }

oWnd:bMButtonUp   = { | nRow, nCol, nFl8ags | oWnd:Say( 2, 2, "MButtonUp    " ) }

oWnd:bRClicked    = { | nRow, nCol, nFlags | oWnd:Say( 2, 2,  "RButtonDown" ) }

oWnd:bRButtonUp   = { | nRow, nCol, nFlags | oWnd:Say( 2, 2,  "RButtonUp    " ) }

//oWnd:bMMoved      = { | nRow, nCol, nFlags | IIF( nRow < oDlg:nTop() .or. ;
//nRow > oDlg:nBottom() .or. ;
//nCol > oDlg:nRight() .or. ;
//nCol < oDlg:nLeft(), oDlg:End(), NIL ) }

oWnd:bLDblClick   = { | nRow, nCol, nFlags | MsgInfo( "Left Doble Click" ) }

SET MESSAGE OF oWnd TO "Press any mouse button" CENTERED

ACTIVATE WINDOW oWnd ;
ON INIT ShowDlg(oWnd)

return nil

//----------------------------------------------------------------------------//

function ShowDlg(oWnd)

DEFINE DIALOG oDlg FROM 150, 150 TO 300, 400 OF oWnd PIXEL TITLE "A Dialog Box"

ACTIVATE DIALOG oDlg NOWAIT ;
ON PAINT oDlg:Say( 1, 1, "Hello" ) ;
VALID ( MsgInfo( "Valid Clause" ), .t. )

oDlg:bMoved := { || oDlg:CoorsUpdate() }  // !!!!

return nil


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: mouse - dialog
Posted: Thu Nov 15, 2012 10:27 AM
Hello Uwe,
thank you for your help.
But
oDlg:bMoved := { || oDlg:CoorsUpdate() }
does not pass focus.
I found for me the solution in using a NOMODAL dialog.
Moving the mouse to the right screenboarder opens.
If mouse cursor is not over the dialog the dialog is closed.
Best regards,
Otto



Continue the discussion