TBITMAP and dbl Left Click, Right Click (SOLVED)

TBITMAP and dbl Left Click, Right Click (SOLVED)

Postby Horizon » Sun Dec 21, 2008 8: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.



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
Last edited by Horizon on Sun Dec 21, 2008 9:40 pm, edited 2 times in total.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Image Tooltip, Right-Click and Left-DblClick

Postby ukoenig » Sun Dec 21, 2008 9:18 pm

Hello,

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

Code: Select all  Expand view
.....
.....
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 :lol:
Last edited by ukoenig on Sun Dec 21, 2008 9:27 pm, edited 2 times in total.
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

Postby Daniel Garcia-Gil » Sun Dec 21, 2008 9: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
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby Horizon » Sun Dec 21, 2008 9: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.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 90 guests