Mouse events on MDI-frame ?

Mouse events on MDI-frame ?

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

Re: Mouse events on MDI-frame ?

Postby Enrico Maria Giordano » Thu Mar 29, 2012 8:14 am

Code: Select all  Expand view
// 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
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Mouse events on MDI-frame ?

Postby ukoenig » 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.

Image

The calculated Menu :

Code: Select all  Expand view

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) ) )

Image

Code: Select all  Expand view

// ------- 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 :lol:
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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Otto and 86 guests