A Button-effect for BMP > oBmp:bLClicked ?

A Button-effect for BMP > oBmp:bLClicked ?

Postby ukoenig » Fri Sep 12, 2008 8:18 am

Hello,

For a new project, I'm looking for a Button-effect for the method:
< oBmp:bLClicked > to get a Button-look.
It means : a < pressed-effect > and changing the mouse-cursor inside the bitmap-earea.
Maybe to add something inside the BMP-class ?
Is there a sample for it ?

Image

Code: Select all  Expand view

@ 4, 16 BITMAP oBmp FILENAME "..\bitmaps\Tutanka1.bmp" ADJUST SIZE 280, 200 OF oWnd
   
oBmp:bLClicked := {|| Msgalert( "Button" ) }



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

Postby James Bott » Fri Sep 12, 2008 1:37 pm

Uwe,

Code: Select all  Expand view
#include "fivewin.ch"

function main()
   local oWnd, oBmp

   define window oWnd title "Test Mouse Over"

   @ 4, 16 BITMAP oBmp FILENAME "Tutanka1.bmp" ADJUST SIZE 280, 200 OF oWnd

   oBmp:bLClicked := {|| Msgalert( "Button" ) }

   oBmp:bMMoved := { || cursorhand() }

   activate window oWnd

return nil
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Cursor-hand on BMP

Postby ukoenig » Fri Sep 12, 2008 2:09 pm

James,

thank you very much,
The line is added to the source-sample.

I had a look at

Code: Select all  Expand view

oBmp:lStretch := .f.
nZoom:=nZoom-(0.10)
oBmp:Zoom(nZoom)
oBmp:Refresh()
oBmp:ScrollAdjust()

and than :

oBmp:lStretch := .f.
nZoom:=nZoom+0.10
oBmp:Zoom(nZoom)
oBmp:Refresh()
oBmp:ScrollAdjust()

do get a visual click-effect

maybe it doesn't work with resources ?

A visual-effect you can get with :

oBmp4:bLClicked := {|| ( oBmp4:Hide(), oBmp4:Show(), ;
MsgAlert( "Your Function 1" ) ) }



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

activated BMP

Postby ukoenig » Fri Sep 12, 2008 10:24 pm

Hello James,

I found a way, to solve the problem

Image

Code: Select all  Expand view

// blClicked changes the Color
// the user can see, if a button is activated.
// after closing the dialog or message, the old color is restored to the button.
// but maybe you have still another idea ?

REDEFINE BITMAP oBmp4  ID 210 ADJUST RESOURCE "Blanc"  OF oDlg
oBmp4:bLClicked := {|| ( oBMP4:bPainted := ;
{ |hDC|OnPaintV( hDC,oBMP4, 128,15779475,0, ;
"Vertical  Button", oBfont1, 0 ,"TEST.BMP" ,4 ) }, oBmp4:Refresh(), ;
MsgAlert( "Your Function 1" ), ;
oBMP4:bPainted := { |hDC|OnPaintV( hDC,oBMP4, 13003573,15779475,0, ;
"Vertical  Button",  oBfont1, 0 ,"TEST.BMP" ,4 ) }, oBmp4:Refresh() ) }
oBmp4:bMMoved := { || cursorhand() }

// The init Color
// ---------------
oBMP4:bPainted := { |hDC|OnPaintV( hDC,oBMP4, 13003573,15779475,0, ;
"Vertical  Button", oBfont1, 0 ,"TEST.BMP" ,4 ) }



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: No registered users and 81 guests