Size buttons in metroPanel

Size buttons in metroPanel

Postby Natter » Wed Mar 23, 2016 12:58 pm

Is it possible to specify the size of the buttons in metroPanel ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby ukoenig » Wed Mar 23, 2016 1:41 pm

Yes see the settings :

DEFINE METROPANEL oMetro OF oWnd TITLE "Stammdaten" ;
COLOR aVal[8], CLR_BLUE
oMetro:oFont := oFontLarge
oMetro:lDesignMode := .F.
oMetro:nMetroTop = 160
oMetro:nMetroMargin := 50
oMetro:nBtnSize = 120
oMetro:nMetroRows := 8

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

Re: Size buttons in metroPanel

Postby Natter » Wed Mar 23, 2016 2:01 pm

O'k, thanks !

Is it possible to enable/disable scolling metroPanel ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby Antonio Linares » Thu Mar 24, 2016 7:27 am

Try this:

oMetroPanel:nScrollRange = 0
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Size buttons in metroPanel

Postby Natter » Thu Mar 24, 2016 12:14 pm

No, oMetroPanel:nScrollRange = 0, not helped

I got the desired result of rewriting methods lButtonDown and MouseWheel
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby cnavarro » Thu Mar 24, 2016 12:23 pm

Natter wrote:O'k, thanks !

Is it possible to enable/disable scolling metroPanel ?


Look

viewtopic.php?f=3&t=28288&p=158418&hilit=metropnel#p158418
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Size buttons in metroPanel

Postby Natter » Thu Mar 24, 2016 1:43 pm

Many thanks !
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby ukoenig » Thu Mar 24, 2016 1:48 pm

Cristobal,

maybe adding as well a solution to get a button-focus-effect.
For the moment I added a little function to paint a border around the button
on focus and destroy the border on lost focus.
I had to find another solution because there is no action on
:bgotfocus and :bLostfocus.
That works fine and the user can select the border-color and pensize.
Also I asked for showing a button < disabled > if possible.

I still remember a question about < on button-move > saving the new button-positions
This option is disabled using my solution because of using < :bMMoved >

sample :

DEFINE METROBUTTON oSBtn[60] OF oMenu1 ;
COLOR aVal[73], aVal[72] ;
CAPTION "Rechnungen" ;
ALIGN "TOPLEFT" ;
GROUP 2 ;
BITMAP c_Pfad1 + "Save.bmp" ;
BMPALIGN "MIDDLECENTER" ;
SIZE 50, 50 ;
ACTION RECHNUNG("RECH0") ;
BODYTEXT "testen" ;
TEXTALIGN "BOTTOMCENTER"
oSBtn[60]:nClrCaption := aVal[74]
oSBtn[60]:oFont := oFontTiny
oSBtn[60]:oTextFont := oFontTiny
oSBtn[60]:bMMoved = { | nRow, nCol, nFlags | SHOW_FRAME( oSBtn, 60, nOld ), nOld := 60 }

Image

Code: Select all  Expand view

oSBtn[1]:bMMoved   = { | nRow, nCol, nFlags | SHOW_FRAME( oSBtn, 1, nOld ), nOld := 1 }

FUNCTION SHOW_FRAME(oBtn, n, nOld)
LOCAL I

FOR I := 1 TO LEN( oBtn )
    IF I = nOld .and. n <> nOld
        oBtn[i]:Refresh()
    ENDIF
    IF oBtn[I] <> NIL  
        IF oBtn[I]:lLarge = .F. .and. i = n
            RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth()-1, ;
                            oBtn[i]:nHeight()-1, , , aVal[81], aVal[82] )  
        ELSEIF oBtn[I]:lLarge = .T. .and. i = n
            RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth() -1, ;
                            oBtn[i]:nHeight()-1, , , aVal[81], aVal[82] )  
        ENDIF
    ENDIF
NEXT

RETURN NIL
 


best regards
Uwe :?:
Last edited by ukoenig on Fri Mar 25, 2016 6:21 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: Size buttons in metroPanel

Postby Natter » Fri Mar 25, 2016 2:55 pm

As you can move metropanel to the extreme left/right position ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby cnavarro » Fri Mar 25, 2016 3:51 pm

Natter wrote:As you can move metropanel to the extreme left/right position ?


It has to build another method CONSTRUCTOR


Code: Select all  Expand view


METHOD NewAt( oWnd, cTitle, nClrText, nClrPane, bLClicked, nBtnSize, ;
            nClrThumb, nClrScroll, nRow, nCol, nHeight, nWidth ) CLASS TMetroPanel

   DEFAULT cTitle := "Start", nClrText := CLR_WHITE, nClrPane := CLR_GREEN

   DEFAULT ::nBtnSize      := IfNil( nBtnSize, 132 )
   DEFAULT ::nMetroRows    := Int( GetSysMetrics( 1 ) / ( ::nBtnSize + BTN_GAP ) ) - 1
   DEFAULT ::nMetroTop     := ::nBtnSize
   DEFAULT ::nMetroMargin  := ::nBtnSize

   ::Super:New( 0,  0, GetSysMetrics( 1 ) , GetSysMetrics( 0 ), oWnd )   // Here nRow, nCol, nHeight, nWidth

.../...


 
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Size buttons in metroPanel

Postby Natter » Sat Mar 26, 2016 4:41 pm

Metropanel can be moved if the mouse cursor is located on the meytopanel. If the cursor is on any mrtrobutton, it starts processing drag and drop this button.
As instead of drag and drop buttons to move metropanel ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Re: Size buttons in metroPanel

Postby cnavarro » Mon Mar 28, 2016 9:17 am

ukoenig wrote:Cristobal,

maybe adding as well a solution to get a button-focus-effect.
For the moment I added a little function to paint a border around the button
on focus and destroy the border on lost focus.
I had to find another solution because there is no action on
:bgotfocus and :bLostfocus.
That works fine and the user can select the border-color and pensize.
Also I asked for showing a button < disabled > if possible.

I still remember a question about < on button-move > saving the new button-positions
This option is disabled using my solution because of using < :bMMoved >

sample :

DEFINE METROBUTTON oSBtn[60] OF oMenu1 ;
COLOR aVal[73], aVal[72] ;
CAPTION "Rechnungen" ;
ALIGN "TOPLEFT" ;
GROUP 2 ;
BITMAP c_Pfad1 + "Save.bmp" ;
BMPALIGN "MIDDLECENTER" ;
SIZE 50, 50 ;
ACTION RECHNUNG("RECH0") ;
BODYTEXT "testen" ;
TEXTALIGN "BOTTOMCENTER"
oSBtn[60]:nClrCaption := aVal[74]
oSBtn[60]:oFont := oFontTiny
oSBtn[60]:oTextFont := oFontTiny
oSBtn[60]:bMMoved = { | nRow, nCol, nFlags | SHOW_FRAME( oSBtn, 60, nOld ), nOld := 60 }

Image

Code: Select all  Expand view

oSBtn[1]:bMMoved   = { | nRow, nCol, nFlags | SHOW_FRAME( oSBtn, 1, nOld ), nOld := 1 }

FUNCTION SHOW_FRAME(oBtn, n, nOld)
LOCAL I

FOR I := 1 TO LEN( oBtn )
    IF I = nOld .and. n <> nOld
        oBtn[i]:Refresh()
    ENDIF
    IF oBtn[I] <> NIL  
        IF oBtn[I]:lLarge = .F. .and. i = n
            RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth()-1, ;
                            oBtn[i]:nHeight()-1, , , aVal[81], aVal[82] )  
        ELSEIF oBtn[I]:lLarge = .T. .and. i = n
            RoundBox( hDC := oBtn[n]:GETDC(),  2, 2, oBtn[i]:nWidth() -1, ;
                            oBtn[i]:nHeight()-1, , , aVal[81], aVal[82] )  
        ENDIF
    ENDIF
NEXT

RETURN NIL
 


best regards
Uwe :?:


Uwe, please excuse the delay in answering
I will look at its implementation
Thank you
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: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 48 guests