Btnbmp disabled

Btnbmp disabled

Postby Silvio.Falconi » Fri Jul 05, 2024 10:36 am

Can change the text color of a tbtnbmp if it is disabled ?

Now I have this but the text is not visible clear


Image

the tbtnbmp is created with
Code: Select all  Expand view
@ 10, 10  BTNBMP aGet[3] OF oDlg;
                PROMPT cDesc RIGHT;
                SIZE 193, 12  PIXEL FLAT NOROUND
               aGet[3]:bClrGrad := { | lPressed | If( ! lPressed,;
                 { { 1, DLG_nColorBar1, DLG_nColorBar1} },;
                 { { 1, DLG_nColorBar2, DLG_nColorBar2} } ) }
                     aGet[3]:nClrBorder := DLG_nColorBtnB
                     aGet[3]:DISABLE()
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Btnbmp disabled

Postby Jimmy » Fri Jul 05, 2024 2:51 pm

Hi Silvio,
what about show a Gray Style Bitmap on tbtnbmp ?

Fivewin have
Code: Select all  Expand view
HB_FUNC( DRAWGRAY ) // ( hDC, hBitmap, nRow, nCol, nWidth, nHeight ) --> nil

in \source\winapi\bmpdraw.c
to draw Bitmap in Gray Style to show Disable Status
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Btnbmp disabled

Postby karinha » Fri Jul 05, 2024 4:44 pm

Code: Select all  Expand view

// \SAMPLES\ALVAREZ.PRG - 05/07/2024.

#Include "FiveWin.ch"  //-> The Best...

FUNCTION Espera_Alvarez()

   LOCAL oDlg, oFld, oFont, aGrad, oBrush1, oBrush2, oBtn
   LOCAL aBitmaps := { "..\bitmaps\alphabmp\facebook.bmp", ;
                       "..\bitmaps\alphabmp\windows.bmp" }

   LOCAL nTempo_espera, cNome_funcao, lTimercontinua

   // -> 1 hora tem 3600 segundos.
   nTempo_espera := 15  // segundos.

   cNome_funcao := "LOGOFF()"  

   lTimercontinua := .F.

   aGrad := { { 0.30, CLR_WHITE, CLR_HBLUE },{ 0.50, CLR_HBLUE, CLR_WHITE } }

   DEFINE BRUSH oBrush1 COLOR nRGB( 250, 213, 174 ) STYLE HORIZONTAL
   DEFINE BRUSH oBrush2 COLOR nRGB( 192, 192, 192 ) STYLE HORIZONTAL

   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 00, -14 BOLD
                     
   DEFINE DIALOG oDlg TITLE "- TFolderex - Testing -" SIZE 350, 350          ;
      PIXEL TRUEPIXEL RESIZABLE // GRADIENT aGrad
     
   @ 1, 0 FOLDEREX oFld PIXEL ADJUST OF oDlg ;
      PROMPT "Prenotazioni", "Pagamenti"     ;
      BITMAPS aBitmaps                       ;
      TAB HEIGHT 26 OPTION 1 ROUND 5 FONT oFont COLOR CLR_HGREEN TOP

   oFld:aEnable = { .T., .T., .F. }

   @ 245, 10 BTNBMP oBtn CENTER SIZE 100, 100 PIXEL OF oDlg NOROUND 2007

   // oBtn:lTransparent := .T.

   // oBtn:bClrGrad := {| lInvert | If( lInvert, oBrush2:hBrush, oBrush1:hBrush  ) }
   oBtn:Disable()
   // 350, 0, 500, 400
   oBtn:bPainted := <|hDC|
      FillRectEx( hDC, { 150, 0, 200, 100 }, CLR_HGREEN )
      return nil
      >

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( oFld:Resize(), TINATIVO():NEW( nTempo_espera, cNome_funcao,   ;
                              lTimerContinua ) )

RETURN NIL

// tinativo.prg - By William Adami
// exemplo do uso da classe Tinativo
// Apos um tempo de inatividade do mouse
// e do teclado chama uma funcao qualquer.

//#include "fivewin.ch"

// STATIC oWnd

//************

/*
FUNCTION Main()

   LOCAL nTempo_espera, cNome_funcao, lTimercontinua

   // Tempo a ser esperado ate chamar a funcao
   // -> 1 hora tem 3600 segundos.
   nTempo_espera := 10  // segundos.

   // nome da funcao a ser chamada quando
   // chegar no tempo de espera
   cNome_funcao := "LOGOFF()"  
   // se apos executar a funcao , continua
   // monitorando a inatividade do mouse e teclado.
   lTimercontinua := .F.

   define window oWnd title "Teste de teclado e mouse"

   activate window oWnd ;
      ON INIT tinativo():new( nTempo_espera, cNome_funcao, lTimerContinua )

RETURN NIL
*/


FUNCTION LOGOFF()

   // msgalert( "AQUI ENTRA SUA FUNCAO DE LOGOFF !", "AVISO" )

   IF MsgYesNo( OemToAnsi( "ATEN€ÇO USUµRIO:                       " )+CRLF+ ;
                OemToAnsi( "PROTEJA OS BANCOS DE DADOS DO PROGRAMA." )+CRLF+ ;
                OemToAnsi( "SE NÇO ESTIVER USANDO O ALVAREZ.EXE,   " )+CRLF+ ;
                OemToAnsi( "DESLIGUE-O PARA NÇO CORRER RISCOS.     " )+CRLF+ ;
                OemToAnsi( "POSSO DESLIGAR O PROGRAMA? <S> ou <N>??" ),      ;
                OemToAnsi( "AVISO PARA DESLIGAR O ALVAREZ.EXE...   " ) )

      HB_GCALL( .T. )

      CLEAR MEMORY

      PostQuitMessage( 0 )

      QUIT

   ENDIF

RETURN NIL

//   tinativo.prg -> By William Adami

// #include "fivewin.ch"

CLASS TINATIVO

   DATA nTimeInpAntes
   DATA nTimeInpDepois
   DATA cTimeAtu
   DATA nTempo
   DATA oTimerTime
   DATA cFunc
   DATA lContinuar

   METHOD NEW( nTime, cFuncao, lContinua )  CONSTRUCTOR

   METHOD ver_tempo()

ENDCLASS

METHOD new( ntime, cFuncao, lContinua ) CLASS TINATIVO

   ::cfunc := cfuncao
   ::ntempo := ntime
   ::lContinuar := lContinua
   ::oTimerTime := TTimer():New( 1000, { || ::VER_TEMPO() } )
   ::oTimerTime:Activate()
   ::cTimeAtu := time()
   ::nTimeInpAntes := getInputState()    // 0 = erro

RETURN self

METHOD VER_TEMPO CLASS TINATIVO

   LOCAL AUX

   ::nTimeInpDepois := getInputState()

   IF ( ::nTimeInpDepois - ::nTimeInpAntes ) > 0

      ::nTimeInpAntes := getInputState()

      ::cTimeAtu := time()

   ENDIF


   IF ( CONVTIME( time() ) - CONVTIME( ::cTimeAtu ) ) > ::ntempo

      ::oTimerTime:DeActivate()

      aux := ::cfunc
   
      // aqui executa a funcao

      &aux

      if ::lContinuar

         ::oTimerTime:Activate()
         ::cTimeAtu := time()

      ENDIF


   ENDIF

RETURN NIL

FUNCTION CONVTIME( ZZ )

   LOCAL Z

   Z := ( VAL( LEFT(ZZ,2 ) ) * 360 ) + ( VAL( SUBSTR(ZZ,4,2 ) ) * 60 ) + ;
          VAL( RIGHT( ZZ,2 ) )

RETURN Z

//*----------------------------------------------------------------------
#pragma BEGINDUMP
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500
#include "windows.h"
#include "hbapi.h"
HB_FUNC( GETINPUTSTATE )
{
LASTINPUTINFO lpi;
lpi.cbSize = sizeof(LASTINPUTINFO);
if (!GetLastInputInfo(&lpi))
{
hb_retni(0);
}
hb_retni(lpi.dwTime);
}
#pragma ENDDUMP

// fin / end
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Btnbmp disabled

Postby nageswaragunupudi » Sun Jul 07, 2024 1:35 pm

Can change the text color of a tbtnbmp if it is disabled ?


Yes.
Code: Select all  Expand view
oBtn:lDisColor := .f.
oBtn:nClrTextDis := <nDisabledColor> // of your choice
Regards

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

Re: Btnbmp disabled

Postby Silvio.Falconi » Sun Jul 07, 2024 3:56 pm

nageswaragunupudi wrote:
Can change the text color of a tbtnbmp if it is disabled ?


Yes.
Code: Select all  Expand view
oBtn:lDisColor := .f.
oBtn:nClrTextDis := <nDisabledColor> // of your choice

Thanks Rao
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 68 guests

cron