Get...bitmap..action

Get...bitmap..action

Postby Silvio.Falconi » Sat Nov 27, 2021 4:28 pm

I wish to show mail.bmp when on get there is a cr,if the get is empty the control get must not have the button

I try with this test

Code: Select all  Expand view  RUN

#include "fivewin.ch"

Function test()
local oDlg,oGet,oFont,oBold
local aGet[1]
local cEmail:=Space(30)

 DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
 DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-14 BOLD

DEFINE DIALOG oDlg SIZE  400,40   PIXEL TRUEPIXEL ;
   COLOR CLR_BLACK,  nRgb( 245,244,234)  FONT oFont  ;
   TITLE "ww"

@ 10, 12 GET aGet[1] VAR cEmail ;
          BITMAP IIF(!Empty(cEMail),"mail.bmp","");
          SIZE 300,24 PIXEL OF oDlg ;
          ACTION Msginfo("Email")  ;
           ON CHANGE  IIF(!Empty(cEMail),;
                          (aGet[1]:oBtn:setfile("mail.bmp"),aGet[1]:oBtn:show()),;
                          aGet[1]:oBtn:Hide())
      aGet[1]:lBtnTransparent := .T.



 Activate DIALOG oDLg center
RETURN NIL

 




I made also

@ 10, 12 GET aGet[1] VAR cEmail ;
BITMAP IIF(!Empty(cEMail),"mail.bmp","");
SIZE 300,24 PIXEL OF oDlg ;
ACTION Msginfo("Email") ;
ON CHANGE cambia(aGET,cEmail)

Function cambia(aGET,cEmail)
IF !Empty(cEMail)
aGet[1]:oBtn:setfile("mail.bmp")
aGet[1]:oBtn:show()
aGet[1]:lBtnTransparent := .T.
else
aGet[1]:oBtn:setfile("")
aGet[1]:oBtn:hide()
aGet[1]:lBtnTransparent := .T.
Endif
aGet[1]:refresh()
RETURN NIL

but it take a buttonbmp instead btnbmp


I think there is a technique to do this because in a dialog I have a lot of get controls that I have to use
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Get...bitmap..action

Postby Jimmy » Sat Nov 27, 2021 10:38 pm

hi,

does FiveWin have WHEN / VALID for GET :?:

if Yes try this
Code: Select all  Expand view  RUN
@ 10, 12 GET aGet[1] VAR cEmail WHEN ;
   cambia(aGET,cEmail)
   ...
   ON CHANGE cambia(aGET,cEmail)


Function cambia(aGET,cEmail)
   ...
RETURN .T.  // MUST be .T. for WHEN / VALID
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Get...bitmap..action

Postby Otto » Sun Nov 28, 2021 8:00 am

Hello Jimmy,
I'm sure you know, but sometimes you don't think about it.

The nice thing about FIVEWIN is that all the source code is available to us.

And as Daniel always says:
our best documentation is the source code

Best regards and have an enjoyable Sunday,
Otto

FWH/source/
classes
function
winapi
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6342
Joined: Fri Oct 07, 2005 7:07 pm

Re: Get...bitmap..action

Postby Silvio.Falconi » Mon Nov 29, 2021 11:04 am

Otto wrote:Hello Jimmy,
I'm sure you know, but sometimes you don't think about it.

The nice thing about FIVEWIN is that all the source code is available to us.

And as Daniel always says:
our best documentation is the source code

Best regards and have an enjoyable Sunday,
Otto

FWH/source/
classes
function
winapi



Yes, of course
But Prof. Mr. Otto you Know how make it?
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Get...bitmap..action

Postby karinha » Mon Nov 29, 2021 3:07 pm

See this example if it helps. It's not half full, and you can change the will when the example is complete, understand?

Code: Select all  Expand view  RUN

// \SAMPLES\SILMAIL.PRG - 29/11/2021 - kapiabafwh@gmail.com.

#Include "FiveWin.ch"

STATIC oBtn, lBtnSshow := .T.

FUNCTION Btn_Mail()

   LOCAL oDlg, oGet, oFont, oBold, oSkinB, oBtnBmp
   LOCAL aGet   := ARRAY(5)
   LOCAL cEmail := SPACE(50), n2 := 1

   SetBalloon( .T. ) // Balloon shape required for tooltips

   oSkinB = TSkinButton():New()
   oSkinB:nClrBorder0_N := RGB( 249, 194, 179 )
   oSkinB:nClrBorder1_N := RGB( 181, 61, 29 )
   oSkinB:aClrNormal    := { { 0.2, RGB( 000, 128, 000 ), RGB( 000, 128, 000 ) }, ;
                             { 0.8, RGB( 109, 135, 100 ), RGB( 109, 135, 100 ) } }

   SkinButtons( oSkinB )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0, - 14 BOLD

   DEFINE DIALOG oDlg SIZE 400, 300 PIXEL TRUEPIXEL                        ;
      COLOR CLR_BLACK,  nRgb( 245, 244, 234 )  FONT oFont                  ;
      TITLE "Silvio: Image Btn in GET from code of Silvio."

   oDlg:lHelpIcon := .F.

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   @ 10, 12 GET aGet[1] VAR cEmail PICTURE "@K" OF oDlg SIZE 300, 24 PIXEL ;
      UPDATE FONT oFont COLORS CLR_BLACK, CLR_WHITE WHEN( lBtnSshow )      ;
      BITMAP "..\bitmaps\Clock.bmp"                                        ;
      VALID( Cambia_Btn( aGet, cEmail ) )                                  ;
      ACTION( Cambia_Btn( aGet, cEmail ) )                                 ;
      ON CHANGE( IIF( .NOT. EMPTY( cEmail ),                               ;
         aGet[1]:oBtn:SetFile( "..\bitmaps\plus.bmp"),                     ;
         aGet[1]:oBtn:SetFile( "..\bitmaps\minus.bmp" ) ) )

   aGet[1]:cToolTip := OemToAnsi( "<F7> - Action for Silvio" )

   aGet[1]:lBtnTransparent := .T.
   aGet[1]:lAdjustBtn      := .T.       // Button Get Adjust Witdh aGet[1]
   aGet[1]:lDisColors      := .F.       // Deactive disable color
   aGet[1]:nClrTextDis     := CLR_WHITE // Color text disable status
   aGet[1]:nClrPaneDis     := CLR_CYAN  // Color Pane disable status

   // <F7> Action for Silvio. => one day he will learn.
   aGet[1]:bKeyDown := { |nKey| IF( nKey == VK_F7, Eval( aGet[1]:bAction ), Nil ) }

   @ 44.5, 12 GET aGet[2] VAR n2 OF oDlg SIZE 80, 24 PIXEL                 ;
      VALID( TURNS_GET1( aGet, cEmail ) ) UPDATE

   aGet[2]:cToolTip := "Turn on GET 1 Silvio. You get Silvio, believe me."

   @ 200, 160 BUTTONBMP oBtnBmp OF oDlg SIZE 80, 80 PIXEL                  ;
      BITMAP "..\bitmaps\AlphaBmp\ichat.bmp"                               ;
      ACTION( oDlg:End() ) CANCEL

   oBtnBmp:cToolTip := "Chat or Exit Silvio. one day he will learn."

   ACTIVATE DIALOG oDLg CENTERED

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   oFont:End()
   oBold:End()

RETURN NIL

FUNCTION Cambia_Btn( aGet, cEmail )

   IF EMPTY( cEMail )

      lBtnSshow := .F.

      aGet[1]:oBtn:SetFile( "..\bitmaps\minus.bmp" )

      aGet[1]:Refresh()

   ELSE

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile("..\bitmaps\plus.bmp")

      aGet[1]:Refresh()

   ENDIF

RETURN( .T. )

FUNCTION TURNS_GET1( aGet, cEmail )

   IF GETASYNCKEY( VK_UP )

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile( "..\bitmaps\Clock.bmp" )
      aGet[1]:Refresh()

   ENDIF

   IF GETASYNCKEY( VK_DOWN )

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile( "..\bitmaps\Exit.bmp" )
      aGet[1]:Refresh()

   ENDIF

RETURN( .T. )

// FIN / END
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7834
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Get...bitmap..action

Postby Otto » Mon Nov 29, 2021 3:27 pm

Hello Silvio,
I only mentioned this because Jimmy comes from a different "dBase" corner, where it is absolutely not customary to have access to the language's source code.
It is the generosity of Antonio who provided the source code of FIVEWIN to all of us.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6342
Joined: Fri Oct 07, 2005 7:07 pm

Re: Get...bitmap..action

Postby Silvio.Falconi » Mon Nov 29, 2021 5:35 pm

for my advise
this question must be inserted on the class
show bitmap action only when tget is no empty
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm

Re: Get...bitmap..action

Postby Silvio.Falconi » Mon Nov 29, 2021 5:39 pm

karinha wrote:See this example if it helps. It's not half full, and you can change the will when the example is complete, understand?

Code: Select all  Expand view  RUN

// \SAMPLES\SILMAIL.PRG - 29/11/2021 - kapiabafwh@gmail.com.

#Include "FiveWin.ch"

STATIC oBtn, lBtnSshow := .T.

FUNCTION Btn_Mail()

   LOCAL oDlg, oGet, oFont, oBold, oSkinB, oBtnBmp
   LOCAL aGet   := ARRAY(5)
   LOCAL cEmail := SPACE(50), n2 := 1

   SetBalloon( .T. ) // Balloon shape required for tooltips

   oSkinB = TSkinButton():New()
   oSkinB:nClrBorder0_N := RGB( 249, 194, 179 )
   oSkinB:nClrBorder1_N := RGB( 181, 61, 29 )
   oSkinB:aClrNormal    := { { 0.2, RGB( 000, 128, 000 ), RGB( 000, 128, 000 ) }, ;
                             { 0.8, RGB( 109, 135, 100 ), RGB( 109, 135, 100 ) } }

   SkinButtons( oSkinB )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14
   DEFINE FONT oBold NAME "TAHOMA" SIZE 0, - 14 BOLD

   DEFINE DIALOG oDlg SIZE 400, 300 PIXEL TRUEPIXEL                        ;
      COLOR CLR_BLACK,  nRgb( 245, 244, 234 )  FONT oFont                  ;
      TITLE "Silvio: Image Btn in GET from code of Silvio."

   oDlg:lHelpIcon := .F.

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   @ 10, 12 GET aGet[1] VAR cEmail PICTURE "@K" OF oDlg SIZE 300, 24 PIXEL ;
      UPDATE FONT oFont COLORS CLR_BLACK, CLR_WHITE WHEN( lBtnSshow )      ;
      BITMAP "..\bitmaps\Clock.bmp"                                        ;
      VALID( Cambia_Btn( aGet, cEmail ) )                                  ;
      ACTION( Cambia_Btn( aGet, cEmail ) )                                 ;
      ON CHANGE( IIF( .NOT. EMPTY( cEmail ),                               ;
         aGet[1]:oBtn:SetFile( "..\bitmaps\plus.bmp"),                     ;
         aGet[1]:oBtn:SetFile( "..\bitmaps\minus.bmp" ) ) )

   aGet[1]:cToolTip := OemToAnsi( "<F7> - Action for Silvio" )

   aGet[1]:lBtnTransparent := .T.
   aGet[1]:lAdjustBtn      := .T.       // Button Get Adjust Witdh aGet[1]
   aGet[1]:lDisColors      := .F.       // Deactive disable color
   aGet[1]:nClrTextDis     := CLR_WHITE // Color text disable status
   aGet[1]:nClrPaneDis     := CLR_CYAN  // Color Pane disable status

   // <F7> Action for Silvio. => one day he will learn.
   aGet[1]:bKeyDown := { |nKey| IF( nKey == VK_F7, Eval( aGet[1]:bAction ), Nil ) }

   @ 44.5, 12 GET aGet[2] VAR n2 OF oDlg SIZE 80, 24 PIXEL                 ;
      VALID( TURNS_GET1( aGet, cEmail ) ) UPDATE

   aGet[2]:cToolTip := "Turn on GET 1 Silvio. You get Silvio, believe me."

   @ 200, 160 BUTTONBMP oBtnBmp OF oDlg SIZE 80, 80 PIXEL                  ;
      BITMAP "..\bitmaps\AlphaBmp\ichat.bmp"                               ;
      ACTION( oDlg:End() ) CANCEL

   oBtnBmp:cToolTip := "Chat or Exit Silvio. one day he will learn."

   ACTIVATE DIALOG oDLg CENTERED

   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   oFont:End()
   oBold:End()

RETURN NIL

FUNCTION Cambia_Btn( aGet, cEmail )

   IF EMPTY( cEMail )

      lBtnSshow := .F.

      aGet[1]:oBtn:SetFile( "..\bitmaps\minus.bmp" )

      aGet[1]:Refresh()

   ELSE

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile("..\bitmaps\plus.bmp")

      aGet[1]:Refresh()

   ENDIF

RETURN( .T. )

FUNCTION TURNS_GET1( aGet, cEmail )

   IF GETASYNCKEY( VK_UP )

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile( "..\bitmaps\Clock.bmp" )
      aGet[1]:Refresh()

   ENDIF

   IF GETASYNCKEY( VK_DOWN )

      lBtnSshow := .T.

      aGet[1]:oBtn:SetFile( "..\bitmaps\Exit.bmp" )
      aGet[1]:Refresh()

   ENDIF

RETURN( .T. )

// FIN / END
 



I cannot make this
I have many gets on a dialog with bitmap action, how many sources i must insert?
my advice the show bitmap action only when the get is no empty must be inserted on the tget class

your script run only when tget create btnbmp but if the button is not transparent tget create a buttobmp control, then setfile function is not good
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: 7072
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests