FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Mouse events on MDI-frame ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Mouse events on MDI-frame ?
Posted: Wed Mar 28, 2012 11:01 PM
Hello,

I need Mouse-events on a MDI-frame.
Any Sample ?

The Sample works only MODAL !!!

// Testing the Mouse events

#include "FiveWin.ch"
static oWnd

function Main()

DEFINE WINDOW oWnd TITLE "Testing the Mouse" // ===>>> MDI needed !!!
oWnd:bLClicked = { | nRow, nCol, nFlags | oWnd:Say( 2, 2, "LButtonDown" ) }
oWnd:bLButtonUp = { | nRow, nCol, nFlags | oWnd:Say( 2, 2, "LButtonUp " ) }
oWnd:bMButtonDown = { | nRow, nCol, nFlags | oWnd:Say( 2, 2, "MButtonDown" ) }
oWnd:bMButtonUp = { | nRow, nCol, nFlags | 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 | MsgBeep() }
oWnd:bLDblClick = { | nRow, nCol, nFlags | MsgInfo( "Left Doble Click" ) }

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

ACTIVATE WINDOW oWnd

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: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Mouse events on MDI-frame ?
Posted: Thu Mar 29, 2012 08:14 AM
Code (fw): Select all Collapse
// Testing the Mouse events

#include "FiveWin.ch"
static oWnd

function Main()

DEFINE WINDOW oWnd TITLE "Testing the Mouse" MDI // ===>>> MDI needed !!!
oWnd:oWndClient:bLClicked = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "LButtonDown" ) }
oWnd:oWndClient:bLButtonUp = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "LButtonUp " ) }
oWnd:oWndClient:bMButtonDown = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "MButtonDown" ) }
oWnd:oWndClient:bMButtonUp = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "MButtonUp " ) }
oWnd:oWndClient:bRClicked = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "RButtonDown" ) }
oWnd:oWndClient:bRButtonUp = { | nRow, nCol, nFlags | oWnd:oWndClient:Say( 2, 2, "RButtonUp " ) }
oWnd:oWndClient:bMMoved = { | nRow, nCol, nFlags | MsgBeep() }
oWnd:oWndClient:bLDblClick = { | nRow, nCol, nFlags | MsgInfo( "Left Doble Click" ) }

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

ACTIVATE WINDOW oWnd

return nil


EMG
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Mouse events on MDI-frame ?
Posted: Thu Mar 29, 2012 10:50 AM
Enrico,

Thank You very much.
It works fine now. I can switch between MODAL and MDI.
The menu moves to the defined Position on Right-Mouseclick
( maybe needed to be changed to get a free Area for Logo- and Time/Date-design ).
The selected new Position is saved to the INI-file.



The calculated Menu :

Code (fw): Select all Collapse
IF nMDI = 1 // Modal
   oWnd:bRClicked := {| nRow,nCol | ( IIF( nCol + 590 > nSWidth .and. nRow <= nSHeight, ;
          oDlg:Move( nRow, nSWidth - 610,, ,.T.), NIL ), ; // Width >, Height <
      IIF( nRow + 110 > nSHeight .and. nCol <= nSWidth, ;
          oDlg:Move( nSHeight - 160, nCol,, ,.T.), NIL ), ; // Width <, Height >
      IIF( nCol + 590 > nSWidth .and. nRow + 110 > nSHeight, ;
          oDlg:Move( nSHeight - 160, nSWidth - 610,, ,.T.), NIL ), ; // Width and Height >
      IIF( nRow + 110 < nSHeight .and. nCol + 590 < nSWidth , ;
          oDlg:Move( nRow, nCol,, ,.T.), NIL ), ; // Width and height <
   nMTop := nRow, nMLeft := nCol, oWnd:Refresh() ) }    
ELSE
   oWnd:oWndClient:bRClicked := {| nRow,nCol | ( IIF( nCol + 590 > nSWidth .and. nRow <= nSHeight, ;
          oDlg:Move( nRow, nSWidth - 610,, ,.T.), NIL ), ; // Breite größer, Höhe kleiner
      IIF( nRow + 110 > nSHeight .and. nCol <= nSWidth, ;
          oDlg:Move( nSHeight - 160, nCol,, ,.T.), NIL ), ; // Breite kleiner, Höhe größer
      IIF( nCol + 590 > nSWidth .and. nRow + 110 > nSHeight,;
          oDlg:Move( nSHeight - 160, nSWidth - 610,, ,.T.), NIL ), ; // beide größer
      IIF( nRow + 110 < nSHeight .and. nCol + 590 < nSWidth, ;  
          oDlg:Move( nRow, nCol,, ,.T.), NIL ), ; // beide kleiner
   nMTop := nRow, nMLeft := nCol, oWnd:Refresh() ) }    
ENDIF


It works great for the Logo-display as well.
I call the Logo-function like :

nMDI = 1 // Modal
nMDI = 2 // MDI
IIF( nMDI = 1, P_LOGO2(oWnd) ,P_LOGO2(oWnd:oWndClient) ) )



Code (fw): Select all Collapse
// ------- LOGO ---------------

FUNCTION P_LOGO2(oWnd)

IF nVisible > 0 // closed for repainting
    oLogo:End()
ENDIF

@ aLogo[1], aLogo[2] IMAGE oLogo ; // Top / Left
FILENAME c_Path + "\Images\" + cWLogo ;
NOBORDER ;
SIZE aLogo[3], aLogo[4] ; // Width / Height
OF oWnd ; //oWnd ;
PIXEL ; 
DESIGN ; 
UPDATE ;
TRANSPARENT

oLogo:SetFocus()

oLogo:bMoved := {|| ( aLogo[1] := oLogo:nTop(), ; // Top
          aLogo[2] := oLogo:nLeft(), ; // Left
          aLogo[3] := oLogo:nWidth(), ; 
          aLogo[4] := oLogo:nHeight() ) }

oLogo:bResized := {|| ( aLogo[1] := oLogo:nTop(), ; // Top
          aLogo[2] := oLogo:nLeft(), ; // Left
          aLogo[3] := oLogo:nWidth(), ; 
          aLogo[4] := oLogo:nHeight() ) }

oLogo:bRClicked := {|| MsgAlert( ( "Top : " + ALLTRIM(STR(oLogo:nTop())) + CRLF + ;
          "Left : " + ALLTRIM(STR(oLogo:nLeft())) + CRLF + ;
          "Width : " + ALLTRIM(STR(oLogo:nWidth())) + CRLF + ;
          "Height : " + ALLTRIM(STR(oLogo:nHeight())) ), "Logo - Pos. and Size" ) }

nVisible := 1

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.

Continue the discussion