Adding Metrobutton-frames on button-focus / action

Adding Metrobutton-frames on button-focus / action

Postby ukoenig » Sun Oct 11, 2015 4: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.

Image

Image

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

best regards
Uwe :D
Last edited by ukoenig on Mon Oct 12, 2015 3:58 pm, edited 1 time 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

Re: Adding Metrobutton-frames on button-action

Postby Antonio Linares » Mon Oct 12, 2015 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding Metrobutton-frames on button-action

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Adding Metrobutton-frames on button-action

Postby cnavarro » Mon Oct 12, 2015 10:56 am

Uwe

Are you using?

Code: Select all  Expand view


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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Adding Metrobutton-frames on button-action

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41315
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Adding Metrobutton-frames on button-action

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Adding Metrobutton-frames on button-action

Postby ukoenig » Mon Oct 12, 2015 2: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

Image

Code: Select all  Expand view

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 :D
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 83 guests