Dear friends:
Using the TBtnGet class in a dialog from resources ¿how can modify the color at runtime?
Regards
Problem with TBtnGet (SOLVED)
- Armando
- Posts: 3278
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 3 times
- Contact:
Problem with TBtnGet (SOLVED)
Last edited by Armando on Fri Dec 17, 2021 5:21 pm, edited 1 time in total.
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Antonio Linares
- Site Admin
- Posts: 42602
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 43 times
- Been thanked: 88 times
- Contact:
Re: Problem with TBtnGet
ACTIVATE DIALOG oDlg ON INIT ( oBtnGet:SetColor( nClrText, nClrPane, oBrush ), .T. )
nClrPane and oBrush are optional
nClrPane and oBrush are optional
- Armando
- Posts: 3278
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 3 times
- Contact:
Re: Problem with TBtnGet
Antonio:
Thanks for your help, it works fine.
now, how can I change the color by the ACTION clause?
Regards
Thanks for your help, it works fine.
now, how can I change the color by the ACTION clause?
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Antonio Linares
- Site Admin
- Posts: 42602
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 43 times
- Been thanked: 88 times
- Contact:
Re: Problem with TBtnGet
Creo que hay un malentendido
Estamos hablando de un GET con claúsula ACTION que hace que se muestre un botón al lado derecho del GET
En tal caso sería:
REDEFINE GET oGet ID ... OF oDlg ACTION ( oGet:SetColor( nClrText, nClrPane, oBrush ), otras cosas que necesites hacer )
Estamos hablando de un GET con claúsula ACTION que hace que se muestre un botón al lado derecho del GET
En tal caso sería:
REDEFINE GET oGet ID ... OF oDlg ACTION ( oGet:SetColor( nClrText, nClrPane, oBrush ), otras cosas que necesites hacer )
- Armando
- Posts: 3278
- Joined: Fri Oct 07, 2005 8:20 pm
- Location: Toluca, México
- Been thanked: 3 times
- Contact:
Re: Problem with TBtnGet
Antonio:
No, me refiero a un BTNGET no un GET.
Ya voy avanzando.
Saludos
No, me refiero a un BTNGET no un GET.
Ya voy avanzando.
Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- nageswaragunupudi
- Posts: 10729
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 10 times
- Contact:
Re: Problem with TBtnGet (SOLVED)
Where is TBtnGet class in FWH?
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- karinha
- Posts: 7951
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Problem with TBtnGet (SOLVED)
Master Rao, no és de FiveWin y si de Ricardo Ramirez.
Regards, saludos.
Code: Select all | Expand
*-- PROGRAM FILE -------------------------------------------------------
* Application: Addon for FiveWin
* Description: TBtnGet - Colored TGet class with button
* File Name: tbtnget.prg
* Author: Ricardo Ramirez Tester: Ricardo Ramirez
* Date created: 1998-01-01 Date updated: þ2001-03-26
* Time created: 8:17:12PM Time updated: þ16:028:17M
* Copyright: (c) 1998-2000 by Punto-Co
*
* $Id: btnget.prg,v 1.4 2001/08/10 18:12:21 RRamirez Exp $
*
* Compliments of:
* George Georguiev
*-----------------------------------------------------------------------
#include "FiveWin.ch"
#define GWL_STYLE -16
#define GWL_EXSTYLE -20
#define DS_3DLOOK 4
#define SM_CYVSCROLL 20
CLASS TBtnGet FROM TGet
DATA bAction, cResName, oBtn, lBtnORBmp
DATA nClrPFoText, nClrPFoPane, nClrDef
DATA nBmpWidth, bTmpValid
DATA nClrFocusText, nClrFocusPane // added. There was erased from FW 2.2c
METHOD ClassName() INLINE "TGET"
METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, ;
bValid, nClrFore, nClrBack, oFont, lDesign, oCursor, ;
lPixel, cMsg, lUpdate, bWhen, lCenter, lRight, bChanged,;
lReadOnly, lPassword, lNoBorder, nHelpId, cResName, ;
bAction, lSpinner, bUp, bDown, bMin, bMax, nBmpWidth ) ;
CONSTRUCTOR
METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, ;
nClrFore, nClrBack, oFont, oCursor, cMsg, lUpdate, ;
bWhen, bChanged, lReadOnly, lSpinner, bUp, bDown, bMin, ;
bMax, cResName, bAction ) CONSTRUCTOR
METHOD Default()
METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()
METHOD SetIniClr()
METHOD Move()
METHOD CalcDims( nTop, nLeft, nWidth, nHeight )
END CLASS
METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, bValid,;
nClrFore, nClrBack, oFont, lDesign, oCursor, lPixel, cMsg,;
lUpdate, bWhen, lCenter, lRight, bChanged, lReadOnly,;
lPassword, lNoBorder, nHelpId, cResName, bAction, lSpinner,;
bUp, bDown, bMin, bMax, nBmpWidth ) CLASS TBtnGet
Super:New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, ;
bValid, nClrFore, nClrBack, oFont, lDesign, oCursor, ;
lPixel, cMsg, lUpdate, bWhen, lCenter, lRight, bChanged, ;
lReadOnly, lPassword, lNoBorder, nHelpId, lSpinner,;
bUp, bDown, bMin, bMax )
DEFAULT nBmpWidth := 17
::nStyle := nOr( ::nStyle, ES_MULTILINE )
::bAction := bAction
::cResName := cResName
::lBtnORBmp := .F.
::nBmpWidth := nBmpWidth
::SetIniClr()
Return Self
METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, nClrFore,;
nClrBack, oFont, oCursor, cMsg, lUpdate, bWhen, ;
bChanged, lReadOnly, lSpinner, bUp, bDown, bMin, ;
bMax, cResName, bAction, nBmpWidth ) CLASS TBtnGet
Super:ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, ;
nClrFore, nClrBack, oFont, oCursor, cMsg, lUpdate, ;
bWhen, bChanged, lReadOnly, lSpinner, bUp, bDown, ;
bMin, bMax )
DEFAULT nBmpWidth := 22
::nStyle := nOr(::nStyle, ES_MULTILINE )
::bAction := bAction
::cResName := cResName
::lBtnORBmp := .F.
::nBmpWidth := nBmpWidth
::SetIniClr()
SetWindowLong( ::hWnd, GWL_STYLE, nOr( GetWindowLong( ::hWnd, GWL_STYLE ) , ES_MULTILINE ) )
Return Self
METHOD Default() CLASS TBtnGet
local nRectLen, l3Dlook
Local nTop, nLeft, nWidth, nHeight
IF empty( ::bAction )
Return Nil
ENDIF
//MSGINFO( GetWindowLong( ::oWnd:hWnd, GWL_STYLE ))
IF !lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_MULTILINE )
//MsgStop("Sorry, but you need to define the ID " + ltrim( str( ::nId ) ) + " as MULTILINE ")
endif
if lAnd( GetWindowLong( ::hWnd, GWL_STYLE ) , ES_MULTILINE )
//MsgInfo("Si soy")
else
//MsgInfo("no soy")
Endif
//SetWindowLong( ::hWnd, GWL_EXSTYLE, nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ) , ES_MULTILINE ) )
nRectLen := ::CalcDims( @nTop, @nLeft, @nWidth, @nHeight )
::oBtn := TBtnDown():New( nTop, nLeft, nWidth, nHeight, ;
::cResName,, ::cResName,, {|| Self:SetFocus(), ;
eval( ::bAction ) }, Self,"",, .F., .F.,"", ,, , .f. )
::bKeyDown := { | nKey | IIF( nKey == VK_F7, ;
eval( ::bAction ), "" ) }
::oBtn:bGotFocus := {|| ::bTmpValid := ::bValid, ::bValid := nil, ;
::oWnd:nLastKey := 0 }
::oBtn:bLostFocus := {|| ::bValid := ::bTmpValid }
GetBtn( ::hWnd, nRectLen )
Return Nil
METHOD SetIniClr() CLASS TBtnGet
::nClrFocusText := nRGB( 000, 000, 000 )
::nClrFocusPane := nRGB( 243, 250, 200 )
::nClrPFoText := ::nClrText
::nClrPFoPane := ::nClrPane
//
::bGotFocus := {|| ::SetColor( ::nClrFocusText, ::nClrFocusPane) }
::bLostFocus := {|| ::SetColor( ::nClrPFoText , ::nClrPFoPane ) }
Return Self
METHOD Move( nTop, nLeft, nWidth, nHeight, lRepaint ) CLASS TBtnGet
Local nRectLen
Super:Move( nTop, nLeft, nWidth, nHeight, lRepaint )
IF ::oBtn != Nil
nRectLen := ::CalcDims( @nTop, @nLeft, @nWidth, @nHeight )
::oBtn:Move( nTop, nLeft, nWidth, nHeight )
ENDIF
Return Nil
METHOD CalcDims( nTop, nLeft, nWidth, nHeight ) CLASS TBtnGet
Local nRectLen
nRectLen := ::nBmpWidth + 4
IF lAnd( GetWindowLong( ::oWnd:hWnd, GWL_STYLE ), DS_3DLOOK )
IF empty( ::cResName )
nLeft := ::nWidth() - 16
nWidth := 12
else
nLeft := ::nWidth() - 26
nWidth := 22
endif
nTop := 0
nHeight := ::nHeight() - 4
else
IF empty( ::cResName )
nLeft := ::nWidth() - 15
nWidth := 14
Else
nLeft := ::nWidth() - 25
nWidth := 24
ENDIF
nTop := 1
nHeight := ::nHeight() - 2
ENDIF
IF empty( ::cResName )
nRectLen -= 9
endif
if ::oVScroll != Nil
nLeft -= GetSysMetrics( SM_CYVSCROLL )
nLeft++
endif
Return nRectLen
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341