ButtonBar style 2015

Re: ButtonBar style 2015

Postby nageswaragunupudi » Tue May 10, 2016 2:56 pm

By default, we can use only 2 colors.
1) Normal color
2) Mouse Over or Pressed

If we want to have 3 colors
1) Normal Color
2) Pressed
3) Mouse Over
please try this sample and adopt:
Code: Select all  Expand view
#include "fivewin.ch"

function Btntest()

   local oWnd

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oWnd:oBar SIZE 32,32 2015

   oWnd:oBar:bClrGrad   := < |lInvert, oBtn|
      if oBtn != nil .and. oBtn:IsKindOf( "TBTNBMP" ) .and. oBtn:lPressed
         return { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ; // Any clr grad of your choice
                  { 2/3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }  }
      elseif lInvert
         return { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } // 2015 : invert
      endif
      return { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } }    // 2015 normal
      >

   DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\new2.bmp"    ACTION BtnAction( This )
   DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\open3.bmp"   ACTION BtnAction( This )
   DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\zoom2.bmp"   ACTION BtnAction( This )
   DEFINE BUTTON OF oWnd:oBar FILE "\fwh\bitmaps\16x16\printer.bmp" ACTION BtnAction( This )

   ACTIVATE WINDOW oWnd CENTERED

return nil

static function BtnAction( oBtn )

   AEval( oBtn:oWnd:aControls, { |o| If( o:IsKindOf( "TBTNBMP" ), o:lPressed := .f., nil ) } )
   oBtn:lPressed := .t.
   oBtn:oWnd:Refresh()

return nil
 


Image

In the above, button 3 is pressed earlier and mouse is now over 1st button.
Regards

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

Re: ButtonBar style 2015

Postby Silvio.Falconi » Tue May 10, 2016 3:46 pm

Thanks Mr Rao this sample is good.. go to make a test to my app!!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: ButtonBar style 2015

Postby Silvio.Falconi » Tue May 10, 2016 4:05 pm

Dear Mr Rao,
I have a oBar and on this I have two oBar

DEFINE BUTTONBAR oBar OF ::oWndMain 3D SIZE 26, 84

oBar:bLClicked := { || NIL }
oBar:bRClicked := { || NIL }

@ -1, -1 BUTTONBAR ::oBar1 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
BUTTONSIZE 26, 27

//sample button
DEFINE BUTTON RESOURCE "RTFNEW" OF ::oBar1 GROUP ;
MESSAGE "Creates a new document" ;
TOOLTIP "New" NOBORDER ;
ACTION ::RTFNew()


::oBar1:bLClicked := { || NIL }
::oBar1:bRClicked := { || NIL }

AEval( ::oBar1:aControls, { |x| x:oCursor := oCursor } )

@ 26, -1 BUTTONBAR ::oBar2 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
BUTTONSIZE 26, 27



//sample button
DEFINE BUTTON RESOURCE "RTFNEW" OF ::oBar1 GROUP ;
MESSAGE "Creates a new document" ;
TOOLTIP "New" NOBORDER ;
ACTION ::RTFNew()


::oBar2:bLClicked := { || NIL }
::oBar2:bRClicked := { || NIL }

AEval( ::oBar2:aControls, { |x| x:oCursor := oCursor, ;
x:nLeft += 219, x:nRight += 219 } )


::oBar1:l2015:=.t.
::oBar2:l2015:=.t.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: ButtonBar style 2015

Postby Silvio.Falconi » Tue May 10, 2016 4:24 pm

Mr Rao taking your test I made some modification ( as I have on my app)

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

function Btntest()

   local oWnd,oCursor
   DEFINE CURSOR oCursor HAND

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar SIZE 26, 84 2015


   oBar:bLClicked := { || NIL }
   oBar:bRClicked := { || NIL }

   @ -1, -1 BUTTONBAR oBar1 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
            BUTTONSIZE 26, 27

   oBar1:l2015:=.t.

    oBar1:bClrGrad   := < |lInvert, oBtn|
      if oBtn != nil .and. oBtn:IsKindOf( "TBTNBMP" ) .and. oBtn:lPressed
         return { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ; // Any clr grad of your choice
                  { 2/3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }  }
      elseif lInvert
         return { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } // 2015 : invert
      endif
      return { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } }    // 2015 normal
      >




   DEFINE BUTTON OF oBar1 FILE "c:\work\fwh\bitmaps\16x16\new2.bmp"    ACTION BtnAction( This )
   DEFINE BUTTON OF oBar1 FILE "c:\work\fwh\bitmaps\16x16\open3.bmp"   ACTION BtnAction( This )


   oBar1:bLClicked := { || NIL }
   oBar1:bRClicked := { || NIL }

   AEval( oBar1:aControls, { |x| x:oCursor := oCursor } )

   @ 26, -1 BUTTONBAR oBar2 OF oBar 3D SIZE oBar:nWidth - 1, 29 ;
            BUTTONSIZE 26, 27

  oBar2:l2015:=.t.

     oBar2:bClrGrad   := < |lInvert, oBtn|
      if oBtn != nil .and. oBtn:IsKindOf( "TBTNBMP" ) .and. oBtn:lPressed
         return { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ; // Any clr grad of your choice
                  { 2/3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) }  }
      elseif lInvert
         return { { 1, RGB( 145, 201, 247 ), RGB( 145, 201, 247 ) } } // 2015 : invert
      endif
      return { { 1, RGB( 244, 244, 245 ), RGB( 244, 244, 245 ) } }    // 2015 normal
      >





    DEFINE BUTTON OF oBar2 FILE "c:\work\fwh\bitmaps\16x16\zoom2.bmp"   ACTION BtnAction( This )
   DEFINE BUTTON OF oBar2 FILE "c:\work\fwh\bitmaps\16x16\printer.bmp" ACTION BtnAction( This )






   ACTIVATE WINDOW oWnd CENTERED

return nil

static function BtnAction( oBtn )

   AEval( oBtn:oWnd:aControls, { |o| If( o:IsKindOf( "TBTNBMP" ), o:lPressed := .f., nil ) } )
   oBtn:lPressed := .t.
   oBtn:oWnd:Refresh()

return nil

 




and it seems run ok ...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: ButtonBar style 2015

Postby Silvio.Falconi » Tue May 10, 2016 5:00 pm

Thanks Mr Rao

Image

It was what I wanted to do
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests