FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour btnbmp style win10
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

btnbmp style win10

Posted: Fri Feb 02, 2018 03: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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: btnbmp style win10

Posted: Sat Feb 03, 2018 09:27 AM

Silvio,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Sat Feb 03, 2018 10:35 AM
thanks antonio,
I take this from another italian application not mine



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

I made
Code (fw): Select all Collapse
#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


the color when the mouse is over is right but the button are showed bad ( 3d ?)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: btnbmp style win10

Posted: Sat Feb 03, 2018 12:02 PM

Silvio,

Try adding NOBORDER to the BtnBmps

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Sat Feb 03, 2018 12:20 PM
Antonio,
Code (fw): Select all Collapse
#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))
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: btnbmp style win10

Posted: 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
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: 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 (fw): Select all Collapse
 @ 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




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 ) )




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 ) )





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:= 0
oBtnCan:= 0

and I have this result



but it is no good
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Sat Feb 10, 2018 08: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

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM

Re: btnbmp style win10

Posted: Mon Feb 12, 2018 08: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 (fw): Select all Collapse
TBtnBmp():lDefaultTheme := .T.


or for a single BtnBmp:
Code (fw): Select all Collapse
oButton:SetThemed(.T.)
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Mon Feb 12, 2018 12:19 PM
sorry Antonino I removed it from my mind :-)

But
Code (fw): Select all Collapse
 #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




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 ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 375
Joined: Tue Feb 10, 2015 09:48 AM

Re: btnbmp style win10

Posted: Mon Feb 12, 2018 01:18 PM
Hello,
I tried this code:
Code (fw): Select all Collapse
#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


Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Tue Feb 13, 2018 11:08 AM
Code (fw): Select all Collapse
 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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Wed Feb 14, 2018 07:58 AM
Probable bug for the color border at line 1590 of btnbmp class
it not change the color border if obtn:= .t.

I wish btnbmp as this


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

can it is possible ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: btnbmp style win10

Posted: Thu Feb 15, 2018 08:55 AM

antonio,
can I have the modifies of nclrborder ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: btnbmp style win10

Posted: 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