Class < BtnBmp > changing to Style 2007 at Runtime ?

Class < BtnBmp > changing to Style 2007 at Runtime ?

Postby ukoenig » Tue Mar 22, 2011 3:01 pm

Hello,

I added the Buttonpart for the new Update.
I can switch Styles for BtnBmp between Color, Gradient and Transparent at Runtime,
but cannot switch back to Style 2007. On init, there is no problem.

Maybe a combination needed with :
oBtn1:l2007 := .T.

Image

Code: Select all  Expand view

REDEFINE BTNBMP oBtn1 ID 500 OF oWndBtnB  2007 ;
FILENAME c_path + "\Bitmaps\32Exit.bmp" ;
LEFT ;
PROMPT " &Exit" ;
FONT oTextFont ;
ACTION  ( oWndBtnB:End() )
oBtn1:cTooltip := "Test-Button"
...
...
REDEFINE SELEX oSelex12 VAR nBtnStyle5 OF oWndBtnB ID 130 ;
ITEMS "2007", "Grad.","Color", "Transp." ;
GRADIENT OUTTRACK { { 0.5, 16770250, 16312263 }, ;
                       { 0.5, 16312263, 16770250 } } ;
GRADIENT INTRACK { { 0.5, 8388608, 16312263 }, ;
                      { 0.5, 16312263, 8388608 } } ;
THUMBSIZE 30, 20 ROUNDSIZE 5 ;
COLOR THUMB 14853684 ;
COLORTEXT 128, 32768 ;
TITLE "Button-Style" TOP ;
FONT oFont5 ;
ACTION BTN_SET( oBtn1 ) ;
COLORTITLE 0
...
...
// -------------

FUNCTION BTN_SET( oBtn1 )

oBtn1:SetSize( 217, nBtnHight5, .T. )

// ITEMS "2007", "Grad.","Color", "Transp."

IF nBtnStyle5 = 1 // Doesn't work at Runtime ( only on Init ) !!!!!!!
    oBtn1:l2007 := .T.
    oBtn1:lTransparent := .F.
ENDIF
IF nBtnStyle5 = 2
    oBtn1:l2007 := .T.
    oBtn1:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
                { { nMove5, nColor5a, nColor5b }, ;
                  { nMove5, nColor5b, nColor5a } },;
                { { nMove5, nColor5a, nColor5b }, ;
                  { nMove5, nColor5b, nColor5a } } ) }
ENDIF
IF nBtnStyle5 = 3
    oBtn1:l2007 := .T.
    oBtn1:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
                { { nMove5, nColor5a, nColor5a }, ;
                  { nMove5, nColor5a, nColor5a } },;
                { { nMove5, nColor5a, nColor5b }, ;
                  { nMove5, nColor5b, nColor5a } } ) }
ENDIF
IF nBtnStyle5 = 4
    oBtn1:l2007 := .F.
    oBtn1:lTransparent := .T.
ENDIF

// --------------------

IF nBRound5 = 1
    oBtn1:lRound := .T.
ELSE   
    oBtn1:lRound := .F.
ENDIF

//---------------------

IF nBorder5 = 1
    oBtn1:lBorder := .T.
ELSE
    oBtn1:lBorder := .F.
ENDIF

oBtn1:Refresh()

RETURN NIL
 


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: Class < BtnBmp > changing to Style 2007 at Runtime ?

Postby ukoenig » Wed Mar 23, 2011 11:52 am

A testfile without Resource ( just copy to folder /samples ) :
Once a different Background is selected ( Color, Gradient or Transparent ),
it is impossible to switch back to Style 2007.
Maybe possible to RESET Buttonstyle and select Style 2007 ?
My Solution, to define a new Gradient ( Style 2007 ), works.

Image

Code: Select all  Expand view

#include "FiveWin.ch"

static oWnd
   
//----------------------------------------------------------------//
function Main()

local oBtn0, oBtn1, oBtn2, oBtn3, oBtn4, oFont
local cVer := FWVERSION
   
DEFINE FONT  oFont  NAME "MS SANS SERIF"  SIZE 0,-12

DEFINE dialog oWnd TITLE "Test Buttonstyle" + cVer size 500,300 pixel
   
@ 10, 10 BTNBMP oBtn0 OF oWnd  ;
SIZE 50, 50 ;
PROMPT cVer FILE "..\BITMAPS\sms.bmp" ;                
FONT oFont BOTTOM ;
ACTION MsgInfo("Testbutton")


// Style 2007
// -------------
@ 100, 10 BTNBMP oBtn1 OF oWnd  ;
SIZE 50, 30   ;
PROMPT "&2007"  2007 ;                
FONT oFont CENTER ;
ACTION BTN_SET( oBtn0, 1 )

// Color
// -------
@ 100, 70 BTNBMP oBtn2 OF oWnd  ;
SIZE 50, 30   ;
PROMPT "Color" 2007 ;                
FONT oFont CENTER ;
ACTION BTN_SET( oBtn0, 2 )

// Gradient
//------------
@ 100, 130 BTNBMP oBtn3 OF oWnd  ;
SIZE 50, 30   ;
PROMPT "&Gradient" 2007 ;                
FONT oFont CENTER ;
ACTION BTN_SET( oBtn0, 3 )

// Transparent
// ----------------
@ 100, 190 BTNBMP oBtn4 OF oWnd  ;
SIZE 50, 30 ;
PROMPT "&Transparent" 2007 ;                
FONT oFont CENTER ;
ACTION BTN_SET( oBtn0, 4 )
     
                     
ACTIVATE DIALOG oWnd CENTER ;
ON INIT BTN_SET( oBtn0, 1 ) // starts with Buttonstyle 2007

return nil

// -------------

FUNCTION BTN_SET( oBtn0, nStyle )

oBtn0:SetSize( 100, 100, .T. )

// ITEMS "2007", "Color", "Grad.", "Transp."

IF nStyle = 1
    oBtn0:l2007 := .T.
    oBtn0:lTransparent := .F.
ENDIF
IF nStyle = 2
    oBtn0:l2007 := .T.
    oBtn0:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
                { { 0.5, 14853684, 14853684 }, ;
                  { 0.5, 14853684, 14853684 } },;
                { { 0.5, 14853684, 16312263 }, ;
                  { 0.5, 16312263, 14853684 } } ) }
ENDIF
IF nStyle = 3
    oBtn0:l2007 := .T.
    oBtn0:bClrGrad = { | lMouseOver | If( ! lMouseOver,;
                { { 0.5, 14853684, 16312263 }, ;
                  { 0.5, 16312263, 14853684 } },;
                { { 0.5, 14853684, 16312263 }, ;
                  { 0.5, 16312263, 14853684 } } ) }
ENDIF
IF nStyle = 4
    oBtn0:l2007 := .F.
    oBtn0:lTransparent := .T.
ENDIF

oBtn0:Refresh()

RETURN NIL
 


It only works with a new Gradient define ( Style 2007 )

Code: Select all  Expand view

IF nStyle = 1
    oBtn0:l2007 := .T.
    oBtn0:lTransparent := .F.
        oBtn0:bClrGrad := { | lInvert | If( lInvert, ;
                       { { 1/3, nRGB( 255, 253, 222 ), nRGB( 255, 231, 151 ) }, ;
                         { 2/3, nRGB( 255, 215,  84 ), nRGB( 255, 233, 162 ) } }, ;
                       { { 1/2, nRGB( 219, 230, 244 ), nRGB( 207-50, 221-25, 255 ) }, ;
                         { 1/2, nRGB( 201-50, 217-25, 255 ), nRGB( 231, 242, 255 ) } } ) }
ENDIF
 


Gradient defined ( Buttonstyle 2007 )

Image

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests