FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TBITMAP and dbl Left Click, Right Click (SOLVED)
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
TBITMAP and dbl Left Click, Right Click (SOLVED)
Posted: Sun Dec 21, 2008 08:32 PM
Hi,

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.



#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
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Image Tooltip, Right-Click and Left-DblClick
Posted: Sun Dec 21, 2008 09:18 PM
Hello,

I tested this and it works without problems.
( tested on a background-image )

.....
.....
ACTIVATE WINDOW oWnd1 MAXIMIZED ;
ON PAINT SHOW_WPIC( oWnd1 )
....
....

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

FUNCTION  SHOW_WPIC( oWnd1 )
LOCAL oImage2
LOCAL aRect := GETCLIENTRECT( oWnd1:hWnd )

cNEWLOGO := "&c_pfad\IMAGE\" + ALLTRIM(W_LOGO)

IF ! Empty( cNEWLOGO ) .and. File( "&cNEWLOGO" )
   @ 0, 0 IMAGE oImage2 SIZE aRect[4], aRect[3] OF oWnd1  ADJUST
   oImage2:LoadBmp( "&cNEWLOGO" )
   oImage2:cTooltip := "This is Tooltip" 
   oImage2:bRClicked = { | nRow, nCol | LabelInspect( oBmp, nRow, nCol )}  
   oImage2:bLDblClick = { || MsgInfo("Dbl Click!!!1")}  
ELSE
   MsgAlert("No file selected !","Attention" )
ENDIF

RETURN( NIL )


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: 2365
Joined: Wed Nov 02, 2005 11:46 PM
TBITMAP and dbl Left Click, Right Click (SOLVED)
Posted: Sun Dec 21, 2008 09:21 PM

dont use PalBmpDraw this only paint imagen but not use correctly the bitmap control

ACTIVATE DIALOG oDlg CENTERED

use
@ 0,0 BITMAP oBmp OF oDlg FILENAME "..\bitmaps\fivewin.bmp" size oDlg:nWidth/2, oDlg:nHeight/2-70 pixel adjust

no use define bitmap

Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
TBITMAP and dbl Left Click, Right Click (SOLVED)
Posted: Sun Dec 21, 2008 09:37 PM
Thanks Uwe, Daniel,

I have removed the PalBmpDraw and used your BITMAP line. It works Ok.


Daniel Garcia-Gil wrote:dont use PalBmpDraw this only paint imagen but not use correctly the bitmap control

ACTIVATE DIALOG oDlg CENTERED


use
@ 0,0 BITMAP oBmp OF oDlg FILENAME "..\bitmaps\fivewin.bmp" size oDlg:nWidth/2, oDlg:nHeight/2-70 pixel adjust

no use define bitmap
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06

Continue the discussion