FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Adding Metrobutton-frames on button-focus / action
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Adding Metrobutton-frames on button-focus / action
Posted: Sun Oct 11, 2015 04:27 PM
I tested a solution adding buttonframes on METRO - buttons on action / click
because there is a missing visible effect. ( showing white button-frames like in Windows10 )
I would like to do this on mousecaption as well, but bGotfocus and bLostfocus doesn't work !
The solution takes care of using normal or large buttons.

It is working for me, but maybe there is still another solution possible.
I noticed changing the button-pos., there is a problem.





Download
http://www.pflegeplus.com/DOWNLOADS/MBtnframe1.zip

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.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 09:10 AM

Uwe,

Your solution is a good one anyhow

How did you try it using bGotfocus and bLostfocus ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 10:38 AM
Antonio,

I only changed / tested :

DEFINE METROBUTTON oMBtn[1] OF oMetro ;
PROMPT "Files" COLOR CLR_WHITE, RGB( 2, 174, 224 ) ;
GROUP 1 ;
IMAGE c_Path1 + "files.bmp" ;
ACTION MsgInfo( oMBtn[1]:Cargo , ValType( oMBtn[1]:Cargo) ) // Files(c_Path1)
// oMBtn[1]:bLClicked := {|| SHOW_FRAME(oMBtn, 1, nOld), nOld := 1 }
oMBtn[1]:bGotFocus := {|| SHOW_FRAME(oMBtn, 1, nOld), nOld := 1 }
oMBtn[1]:oFont := oFontSmall

but NO response
with the other solution I posted, there is still a problem changing the button-positions.
I think the frame-painting on bGotfocus and bLostfocus would be the best.
It is the same, like shown in Windows10

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.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 10:56 AM
Uwe

Are you using?

Code (fw): Select all Collapse
IsOverWnd( hWnd, nRow, nCol ) --> lOver
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 10:57 AM

Uwe,

Please try this to check if the codeblock is evaluated:

oMBtn[1]:bGotFocus := {|| MsgInfo( "yes" ), SHOW_FRAME(oMBtn, 1, nOld), nOld := 1 }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 11:28 AM

Antonio,

tested, but there is NO response at all.

best regards
Uwe :roll:

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: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Adding Metrobutton-frames on button-action
Posted: Mon Oct 12, 2015 02:49 PM
Antonio,

I got it working
Now it looks like shown in Windows10.
The solution I have been looking for : painting a frame on button-focus.

Maybe possible to include the logic in class < Metropnl > like :

:-)
oMetro:lBtnFrame := .T. // frame YES / NO
oMetro:nBtnFramePen := 4 // Pensize
oMetro:nBtnFrameCol := CLR_WHITE // frame-color

Download
http://www.pflegeplus.com/DOWNLOADS/MetroBtn1.zip

Instead using frames, it is possible to display a image on button-caption



Code (fw): Select all Collapse
FUNCTION SHOW_FRAME(oBtn, n, nOld, c_path1)
LOCAL I, oImage

FOR I := 1 TO LEN( oBtn )
     IF oBtn[I] <> NIL  
          IF I = nOld .and. n <> nOld
               oBtn[i]:Refresh()
          ENDIF
          // Using frames
          //IF oBtn[I]:lLarge = .F. .and. i = n
          //   RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth()-1, ;
          //                    oBtn[i]:nHeight(), , , CLR_WHITE, 4 )   
          // ELSEIF oBtn[I]:lLarge = .T. .and. i = n
          //   RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth() -1, ;
          //                    oBtn[i]:nHeight(), , , CLR_WHITE, 4 )  
          // ENDIF
          hDC := oBtn[n]:GETDC()
          oImage := FILoadImg( c_path1 + "Select.bmp" ) // can be different each button-group 
          ABPaint( hDC, 5, 5, oImage, 255 )
     ENDIF
NEXT

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.

Continue the discussion