btnbmp style win10

btnbmp style win10

Postby Silvio.Falconi » Fri Feb 02, 2018 3:11 pm

I have problem to show btnbmp with a bitmap at left and text to right to have the same look of the normal button on windows10
how I can resolve please .do you have a test sample thanks
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Antonio Linares » Sat Feb 03, 2018 9:27 am

Silvio,

Please post a screenshot of what you are looking for, thanks
regards, saludos

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

Re: btnbmp style win10

Postby Silvio.Falconi » Sat Feb 03, 2018 10:35 am

thanks antonio,
I take this from another italian application not mine

Image

the first button is colorized when the user move over the mouse , the second button is colorize as default

I made
Code: Select all  Expand view

#include "Fivewin.ch"

Function test()
Local oDl
Local oBtn[3]
Local  bGrad2015 := { | lInvert | If( ! lInvert,;
                { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
                { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }

DEFINE DIALOG oDlg Size 300,400 COLOR CLR_BLACK,CLR_WHITE



  @ 10,10 BTNBMP oBtn[1]  ;
       FILENAME "allegati.bmp"  ;
       SIZE 45,12               ;
       ACTION NIL               ;
       OF oDlg                  ;
       PROMPT "Allegati"        ;
       NOROUND LEFT             ;
       GRADIENT bGrad2015

  @ 10,60 BTNBMP oBtn[2]  ;
       FILENAME "IMG.bmp"  ;
       SIZE 45,12               ;
       ACTION NIL               ;
       OF oDlg                  ;
       PROMPT "Immagine"        ;
       NOROUND LEFT             ;
       GRADIENT bGrad2015




Activate dialog oDlg
Return nil


and I have this result

Image
the color when the mouse is over is right but the button are showed bad ( 3d ?)
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Antonio Linares » Sat Feb 03, 2018 12:02 pm

Silvio,

Try adding NOBORDER to the BtnBmps
regards, saludos

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

Re: btnbmp style win10

Postby Silvio.Falconi » Sat Feb 03, 2018 12:20 pm

Antonio,
Code: Select all  Expand view
#include "Fivewin.ch"

Function test()
Local oDl
Local oBtn[3]
Local cCursorBtn:=  TCursor():New(,'HAND')
Local  bGrad2015 := { | lInvert | If( ! lInvert,;
                { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
                { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }

DEFINE DIALOG oDlg Size 300,400 COLOR CLR_BLACK,CLR_WHITE


  @ 10,10 BTNBMP oBtn1 FILENAME "DLG_ALLEGO.bmp" DEFAULT;
      PROMPT "Allegati..." FLAT SIZE 45,15 LEFT PIXEL OF oDlg ;
      COLOR CLR_BLACK,CLR_WHITE   GRADIENT bGrad2015 NOBORDER

      oBtn1:nClrBorder := (IIF(oBtn1:lMOver,,CLR_GRAY))
      oBtn1:oCursor := cCursorBtn

 @ 10,60 BTNBMP oBtn2 FILENAME "DLG_IMG.bmp" CANCEL;
      PROMPT "Immagine..." FLAT SIZE 45,15 LEFT PIXEL OF oDlg ;
      COLOR CLR_BLACK,CLR_WHITE   GRADIENT bGrad2015 NOBORDER

      oBtn2:nClrBorder := (IIF(oBtn2:lMOver,,CLR_GRAY))
      oBtn2:oCursor := cCursorBtn




Activate dialog oDlg
Return nil



this go ok bat I wish when the mouse is not over a gray colorborder when the mouse is over I wish not border
it seem it not produce this command oBtn2:nClrBorder := (IIF(oBtn2:lMOver,,CLR_GRAY))
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Antonio Linares » Sat Feb 03, 2018 12:41 pm

Try it this way:

oBtn2:nClrBorder := { || (IIF(oBtn2:lMOver,,CLR_GRAY)) }
regards, saludos

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

Re: btnbmp style win10

Postby Silvio.Falconi » Tue Feb 06, 2018 11:15 pm

not run
Antonio I with the style of Button class on Win10 but with bmp

there is a bug

Code: Select all  Expand view
@ 233, 118 BTNBMP  oBtnOK  RESOURCE "DLG_OK"  ;
      PROMPT "&Conferma" FLAT SIZE 45,15 LEFT PIXEL OF oDlg ;
      COLOR CLR_BLACK,CLR_WHITE   GRADIENT bGrad2015  NOROUND;
      ACTION ( oDlg:end( IDOK ) )

       @ 233, 182 BTNBMP  oBtnCan  RESOURCE "DLG_NO" ;
      PROMPT "&Annulla" FLAT SIZE 45,15 LEFT PIXEL OF oDlg ;
      COLOR CLR_BLACK,CLR_WHITE   GRADIENT bGrad2015  NOROUND;
       ACTION ( oDlg:end( IDCANCEL ) ) GDIPLUS

        oBtnOK:lBorder  :=(IIF(!oBtnOK:lMOver,.t.,.f.))
       oBtnOK:nClrBorder := (IIF(oBtnOK:lMOver,CLR_GRAY,))
       oBtnOK:oCursor := oCursorHand

       oBtnCan:lBorder  :=(IIF(!oBtnCan:lMOver,.t.,.f.))
       oBtnCan:nClrBorder := (IIF( oBtnCan:lMOver,CLR_GRAY,))
       oBtnCan:oCursor := oCursorHand


 



I wrote NOROUND and it make a border with round angles ...why ?




this is only button

Image


this is btnbmp with no resource but with noround

@ 233, 118 BTNBMP oBtnOK ;
PROMPT "&Conferma" FLAT SIZE 45,15 LEFT PIXEL OF oDlg NOROUND;
COLOR CLR_BLACK,CLR_WHITE GRADIENT bGrad2015 ;
ACTION ( oDlg:end( IDOK ) )

Image


this is with resource allways NOROUND

@ 233, 118 BTNBMP oBtnOK RESOURCE "DLG_OK" ; //
PROMPT "&Conferma" FLAT SIZE 45,15 LEFT PIXEL OF oDlg NOROUND;
COLOR CLR_BLACK,CLR_WHITE GRADIENT bGrad2015 ;
ACTION ( oDlg:end( IDOK ) )


Image


If I erase FLat then I have a bad button ...
but if I set NOROUND why I have a round button ?


at the end I made

oBtnOK:nRound:= 0
oBtnCan:nRound:= 0

and I have this result

Image

but it is no good
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Silvio.Falconi » Sat Feb 10, 2018 8:47 am

Antonio
see the last picture
I wish have the border gray when the mouse is not over on the button as the windows10 buttons style
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby AntoninoP » Mon Feb 12, 2018 8:30 am

To be sure of using the same theme of the operating system, you can use my implementation of theme inside TBtnBmp.

For all BtnBmps inside the application:
Code: Select all  Expand view
TBtnBmp():lDefaultTheme := .T.


or for a single BtnBmp:
Code: Select all  Expand view
oButton:SetThemed(.T.)
AntoninoP
 
Posts: 184
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: btnbmp style win10

Postby Silvio.Falconi » Mon Feb 12, 2018 12:19 pm

sorry Antonino I removed it from my mind :)

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

    function main()

       local oDlg, theme
       local oBmp2015
       Local  bGrad2015 := { | lInvert | If( ! lInvert,;
                { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } },;
                { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } ) }

       DEFINE WINDOW oDlg FROM  0,0 TO 300,300 PIXEL TITLE "Test"
       @ 10,10 SAY "custom" PIXEL

       TThemed():New(30,10,oDlg,100,30)


    @ 200,110  BTNBMP  oBmp2015 ; //
           PROMPT "&Conferma" FLAT SIZE 100,30 LEFT PIXEL OF oDlg NOROUND;
           COLOR CLR_BLACK,CLR_WHITE GRADIENT bGrad2015 ;
               ACTION NIL
         oBmp2015:nRound:= 0
            oBmp2015:SetThemed(.T.)


       ACTIVATE WINDOW oDlg CENTERED

    return nil
 


Image

I not have the same effect on secon d button of first (custom)
the custom is good, how i can to insert bitmaps and use cutom button ?
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby AntoninoP » Mon Feb 12, 2018 1:18 pm

Hello,
I tried this code:
Code: Select all  Expand view
#include "fivewin.ch"

function main()

   local oWnd, oBtn
   DEFINE WINDOW oWnd FROM  0,0 TO 300,300 PIXEL TITLE "Test"
   @ 10,10  BTNBMP  oBtn PROMPT "&Conferma"  SIZE 100,30 LEFT PIXEL OF oWnd FILE "ok.png" action oWnd:End()
   oBtn:SetThemed(.T.)


   ACTIVATE WINDOW oWnd CENTERED

return nil
 


Image
AntoninoP
 
Posts: 184
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: btnbmp style win10

Postby Silvio.Falconi » Tue Feb 13, 2018 11:08 am

Code: Select all  Expand view
Function test()


   Local nBottom   := 33
   Local nRight    := 62

   Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local nHeight := nBottom * DLG_CHARPIX_H
   Local oDlg

   DEFINE DIALOG oDlg        ;
   TITLE "test"   ;
   SIZE nWidth, nHeight  PIXEL               ;
        STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_CAPTION,  4 )


     @ 233, 118 BTNBMP  oBtnOK OF oDlg ;
              SIZE 55, 14  PIXEL  ;
               LEFT ;
              PROMPT "&Conferma" FILENAME "DLG_OK.bmp" ;
              ACTION ( oDlg:end( IDOK ) )


     @ 233, 182 BTNBMP  oBtnCan OF oDlg ;
              SIZE 55, 14 PIXEL ;
              BORDER LEFT ROUND ;
              PROMPT "&Annulla" FILENAME "DLG_no.bmp" ;
              ACTION ( oDlg:end( IDCANCEL ) )


           oBtnOK:SetThemed(.T.)
           oBtnOK:nRound:= 0


        ACTIVATE DIALOG oDlg


here not run ok
I not have the same effect of normal button or ttheme button on windows 10 pro
on win10 the button must be gray and when I move th emouse over it must colorized on clear blue and the border color must change

also I use FLAT command and gradient (bGrad2015 wrote on first message of this topic) I not have the effects of a win10 button
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Silvio.Falconi » Wed Feb 14, 2018 7:58 am

Probable bug for the color border at line 1590 of btnbmp class
it not change the color border if obtn:lMover:= .t.

I wish btnbmp as this
Image

with images
the buuton with clear blue is showed when I put the mouse over

can it is possible ?
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby Silvio.Falconi » Thu Feb 15, 2018 8:55 am

antonio,
can I have the modifies of nclrborder ?
I use : FiveWin for Harbour v. 17.11 - Harbour 3.2.0dev (r1703231115)(March 2017) - Bcc7 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
 
Posts: 2731
Joined: Thu Oct 18, 2012 7:17 pm
Location: Teramo - Abruzzo - Italy

Re: btnbmp style win10

Postby nageswaragunupudi » Thu Feb 15, 2018 10:35 am

can I have the modifies of nclrborder ?

Till FWH1712, nClrBorder should be a constant. It can not be a codeblock.
From FWH1801, nClrBorder can be a codeblock.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 5563
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 18 guests