mouse - dialog

mouse - dialog

Postby Otto » Tue Nov 13, 2012 9: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm

Re: mouse - dialog

Postby ukoenig » 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: Select all  Expand view

// 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: mouse - dialog

Postby Otto » 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

Image

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6005
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests