FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Pintar botones (BUTTON/BUTTONBMP) pulsados.
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Pintar botones (BUTTON/BUTTONBMP) pulsados.
Posted: Mon May 11, 2009 09:40 AM

Existe alguna manera de pintar botones que aparezacn con el efecto pulsado. No botones de la toolbar.

El efecto que necesito es que en un panel con multiples botones, al pulsar sobre uno, este quede seleccionado, y pulsado, y si hubiera otro de pulsado, pasara a estado normal.

Gracias.

Saludos desde Mallorca
Biel Maim贸
http://bielsys.blogspot.com/
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Pintar botones (BUTTON/BUTTONBMP) pulsados.
Posted: Mon May 11, 2009 01:05 PM
Biel EA6DD wrote:Esites alguna manera de pintar botones que aparezacn con el efecto pulsado. No botones de la toolbar.

El efecto que necesito es que en un panel con multiples botones, al pulsar sobre uno, este quede seleccionado, y pulsado, y si hubiera otro de pulsado, pasara a estado normal.

Gracias.


Prueba esto, no es un bot贸n sin贸 un checkbox, por lo tanto visualmente tendr谩 lmitaciones, pero hace lo que quieres.

Code (fw): Select all Collapse
*****************************************************************************************
#xcommand @ <nRow>, <nCol> FWDCHECKBOX [ <oCbx> VAR ] <lVar> ;
聽 聽 聽 聽 聽 聽 聽 [ PROMPT <cCaption> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <of:OF, WINDOW, DIALOG> <oWnd> ] ;
聽 聽 聽 聽 聽 聽 聽 [ SIZE <nWidth>, <nHeight> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <help:HELPID, HELP ID> <nHelpId> ] ;
聽 聽 聽 聽 聽 聽 聽 [ FONT <oFont> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <change: ON CLICK, ON CHANGE> <uClick> ] ;
聽 聽 聽 聽 聽 聽 聽 [ VALID 聽 <ValidFunc> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <color: COLOR, COLORS> <nClrFore> [,<nClrBack>] ] ;
聽 聽 聽 聽 聽 聽 聽 [ <design: DESIGN> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <pixel: PIXEL> ] ;
聽 聽 聽 聽 聽 聽 聽 [ MESSAGE <cMsg> ] ;
聽 聽 聽 聽 聽 聽 聽 [ <update: UPDATE> ] ;
聽 聽 聽 聽 聽 聽 聽 [ WHEN <WhenFunc> ] ;
聽 聽 聽 聽 聽 聽 聽 [<left: LEFT>] ;
聽 聽 聽 聽 聽 聽 聽 [<button: LIKEBUTTON>] ;
聽 聽 聽 聽 => ;
聽 聽 聽 聽 聽 [ <oCbx> := ] TFWDCheckBox():New( <nRow>, <nCol>, <cCaption>,;
聽 聽 聽 聽 聽 聽 聽 [bSETGET(<lVar>)], <oWnd>, <nWidth>, <nHeight>, <nHelpId>,;
聽 聽 聽 聽 聽 聽 聽 [<{uClick}>], <oFont>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
聽 聽 聽 聽 聽 聽 聽 <.design.>, <.pixel.>, <cMsg>, <.update.>, <{WhenFunc}>, <.left.>, <.button.> )

*****************************************************************************************
@ 128.50,9.00 FWDCHECKBOX oFWDCk VAR uFWDCk PROMPT "Tots els fitxers" OF ;
聽 聽 oindex00 SIZE 123.00,12.00 FONT J02FONTSAY ON CHANGE FWDCkChange(AMPAarra, ;
聽 聽 oFWDCk, oLbIndex) COLORS J02CLRTEXTO,J02CLRWND PIXEL UPDATE LIKEBUTTON //FIVEWIDI

*****************************************************************************************

/* Left/Button CheckBox
聽 聽-------------*/
#include "FiveWin.ch"

#define BS_LEFTTEXT 聽 聽 聽32
#define BS_PUSHLIKE 聽 聽4096

#ifndef __XPP__
聽 聽#define BM_SETCHECK 聽 ( WM_USER + 1 )
#else
聽 聽#define BM_SETCHECK 聽 241
#endif

#define CB_RESETCONTENT 聽 ( WM_USER + 11 )

#ifdef __XPP__
聽 聽//#define Super ::TControl
聽 聽#define Super ::TCheckBox
聽 聽#define New 聽 _New
#endif

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

CLASS TFWDCheckBox FROM TCheckBox

聽 聽CLASSDATA lRegistered AS LOGICAL

聽 聽METHOD New( nRow, nCol, cCaption, bSetGet, oWnd, nWidth, nHeight,;
聽 聽 聽 聽 聽 聽 聽 聽nHelpTopic, bChange, oFont, bValid, nClrFore, nClrBack,;
聽 聽 聽 聽 聽 聽 聽 聽lDesign, lPixel, cMsg, lUpdate, bWhen, lLeft, lButton ) CONSTRUCTOR

ENDCLASS

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

METHOD New( nRow, nCol, cCaption, bSetGet, oWnd, nWidth, nHeight, nHelpTopic,;
聽 聽 聽 聽 聽 聽 bChange, oFont, bValid, nClrFore, nClrBack, lDesign, lPixel,;
聽 聽 聽 聽 聽 聽 cMsg, lUpdate, bWhen, lLeft, lButton ) CLASS TFWDCheckBox

#ifdef __XPP__
聽 聽#undef New
#endif

聽 聽local lTemp := .f.

聽 聽DEFAULT nRow 聽 聽 聽 := 0, nCol := 0,;
聽 聽 聽 聽 聽 聽cCaption 聽 := "&CheckBox",;
聽 聽 聽 聽 聽 聽oWnd 聽 聽 聽 := GetWndDefault(),;
聽 聽 聽 聽 聽 聽oFont 聽 聽 聽:= If( oWnd:oFont != nil, oWnd:oFont, TFont():New( "System", 8, 9 )),;
聽 聽 聽 聽 聽 聽nWidth 聽 聽 := Len( cCaption ) * oFont:nWidth,;
聽 聽 聽 聽 聽 聽nHeight 聽 聽:= oFont:nHeight + Int( oFont:nHeight / 2 ),;
聽 聽 聽 聽 聽 聽nHelpTopic := 100,;
聽 聽 聽 聽 聽 聽nClrFore 聽 := oWnd:nClrText, nClrBack := oWnd:nClrPane,;
聽 聽 聽 聽 聽 聽lPixel 聽 聽 := .f., lDesign := .f., lUpdate := .f.,;
聽 聽 聽 聽 聽 聽bSetGet 聽 聽:= bSETGET( lTemp ),;
聽 聽 聽 聽 聽 聽lLeft 聽 聽 聽:= .F.,;
聽 聽 聽 聽 聽 聽lButton 聽 聽:= .F.

聽 聽if ValType( Eval( bSetGet ) ) != "L"
聽 聽 聽 Eval( bSetGet, .f. )
聽 聽endif

聽 聽::nTop 聽 聽 聽 = nRow * If( lPixel, 1,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽( oFont:nHeight + Int( oFont:nHeight / 2 ) ) )
聽 聽::nLeft 聽 聽 聽= nCol * If( lPixel, 1, oFont:nWidth ) + If( lPixel, 0, 3 )
聽 聽::nBottom 聽 聽= ::nTop + nHeight
聽 聽::nRight 聽 聽 = ::nLeft + nWidth - If( lPixel, 0, 24 )
聽 聽::cCaption 聽 = cCaption
聽 聽::nStyle 聽 聽 = nOR( WS_CHILD, WS_VISIBLE, BS_AUTOCHECKBOX,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽WS_TABSTOP,;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( lDesign, WS_CLIPSIBLINGS, 0 ), ;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽If( lLeft, BS_LEFTTEXT, If( lButton, BS_PUSHLIKE, 0) ) )
聽 聽::nId 聽 聽 聽 聽= ::GetNewId()
聽 聽::nHelpId 聽 聽= nHelpTopic
聽 聽::bSetGet 聽 聽= bSetGet
聽 聽::bChange 聽 聽= bChange
聽 聽::oWnd 聽 聽 聽 = oWnd
聽 聽::oFont 聽 聽 聽= oFont
聽 聽::bValid 聽 聽 = bValid
聽 聽::lDrag 聽 聽 聽= lDesign
聽 聽::lCaptured 聽= .f.
聽 聽::cMsg 聽 聽 聽 = cMsg
聽 聽::lUpdate 聽 聽= lUpdate
聽 聽::bWhen 聽 聽 聽= bWhen

聽 聽::SetColor( nClrFore, nClrBack )

聽 聽if ValType( Eval( bSetGet ) ) != "L"
聽 聽 聽 Eval( bSetGet, .f. )
聽 聽endif

聽 聽if ! Empty( oWnd:hWnd )
聽 聽 聽 ::Create( "BUTTON" )
聽 聽 聽 ::Default()
聽 聽 聽 oWnd:AddControl( Self )
聽 聽else
聽 聽 聽 oWnd:DefControl( Self )
聽 聽endif

聽 聽if lDesign
聽 聽 聽 ::CheckDots()
聽 聽endif

return Self

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

Un Saludo

Carlos G.



FiveWin 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: Pintar botones (BUTTON/BUTTONBMP) pulsados.
Posted: Mon May 11, 2009 02:26 PM
Biel EA6DD wrote:Esites alguna manera de pintar botones que aparezacn con el efecto pulsado. No botones de la toolbar.
Hola Biel:

Con TSButton puedes usar la variable oBtn:lEverPress que sirve para el prop贸sito que mencionas.

Un abrazo.

Manuel Mercado
manuelmercado at prodigy dot net dot mx
Posts: 682
Joined: Tue Feb 14, 2006 09:48 AM
Re: Pintar botones (BUTTON/BUTTONBMP) pulsados.
Posted: Tue May 12, 2009 07:14 AM

Graias a ambos, probare las dos alternativas para ver cual se adapta mejor a mi necesidad.

Saludos desde Mallorca
Biel Maim贸
http://bielsys.blogspot.com/

Continue the discussion