I try to use Right Click, Dbl Left Click and Tooltip in TBITMAP. I have found the example in genrep.prg in samples directory. It uses the Right click and works. I have copied the related lines to my a little bit modified Login.prg that is from samples directory as below.
But I could not use right click, dbl click and tooltip in my example.
What is wrong in my code?
Thanks in advance.
- Code: Select all Expand view
#include "FiveWin.ch"
function Main()
local oWnd
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT Login( oWnd ) ;
VALID MsgYesNo( "Do you want to end ?" )
return nil
function Login( oWnd )
local oDlg, mUserName := Space( 30 ), mPass := Space( 20 ), lOk := .F.
nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION )
DEFINE DIALOG oDlg TITLE "Login" SIZE 300,350 STYLE NSTYLE
DEFINE BITMAP oBmp OF oDlg FILENAME "..\bitmaps\fivewin.bmp"
oBmp:cTooltip := "This is Tooltip"
oBmp:bRClicked = { | nRow, nCol | LabelInspect( oBmp, nRow, nCol ) }
oBmp:bLDblClick = { || MsgInfo("Dbl Click!!!1")}
nHBasla:=oDlg:nHeight-255
@ nHBasla+023,4 GROUP oGrp1 TO nHBasla+60,146 Pixel
nHBasla:=oDlg:nHeight-224
@ nHBasla+000, 10 SAY "Login Name" PIXEL
@ nHBasla+014, 10 SAY "Password" PIXEL
@ nHBasla+(-2), 50 GET mUserName PICTURE "@!" VALID ! Empty( mUserName ) SIZE 90, 12 PIXEL
@ nHBasla+012, 50 GET mPass PICTURE "@!" VALID ! Empty( mPass ) SIZE 90, 12 PASSWORD PIXEL
@ nHBasla+033, 25 BUTTON oBtn PROMPT "Login" PIXEL;
ACTION ( lOk := .T., oDlg:End() )
@ nHBasla+033, 80 BUTTON "Cancel" ACTION ( lOk := .F., oDlg:End() ) CANCEL PIXEL
ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT PalBmpDraw( hDC, 0, 0, oBmp:hBitmap,,oDlg:nWidth-7,oDlg:nHeight-140)
if ! lOk
oWnd:bValid = nil
oWnd:End()
endif
return nil
function LabelInspect( oSay, nRow, nCol )
local oMenu
MENU oMenu POPUP
MENUITEM "&Colors..." ACTION oSay:SelColor()
MENUITEM "&Font..." ACTION oSay:SelFont()
ENDMENU
ACTIVATE MENU oMenu AT nRow, nCol OF oSay
return nil