show /hide a bitmap on a get

show /hide a bitmap on a get

Postby Silvio.Falconi » Fri Feb 24, 2023 9:19 am

I have this tget control

When the cSeek is empty it must not show any button
when the user insert any digit it must show the button and the bitmap
How resolve it?

Code: Select all  Expand view  RUN
 #include "FiveWin.ch"
 
function Main()        
 
   local oDlg,oGet      
   local cSeek:= Space(100)

   DEFINE DIALOG oDlg TITLE "Test"        
 
   @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                     BITMAP ".\bitmaps\elimina.bmp";
                      ACTION (cSeek    := Space( 100 ),;
                                      oGet:refresh()) ;
                 
                       oGet:lBtnTransparent :=.t.
                       oGet:bChange  := { ||ChangeGetBtn(oGet,cseek) }
                      oGet:bKeyDown := { ||ChangeGetBtn(oGet,cseek)  }
                       ACTIVATE DIALOG oDlg CENTERED  ;
                       ON INIT ( oGet:cBmpName:="",oGet:oBtn:hide())
return nil
//----------------------------------------------------------------------//
Function ChangeGetBtn(oGet,cseek)
   IF EMPTY( cseek )
      oGet:oBtn:hide()
      oGet:cBmpName:=""
     * oGet:Refresh()
   ELSE
      oGet:oBtn:show()
      oGet:cBmpName:=".\bitmaps\elimina.bmp"
      oGet:Refresh()
   ENDIF
return .t.
 
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: show /hide a bitmap on a get

Postby cmsoft » Fri Feb 24, 2023 11:44 am

Silvio:
Mira si te sirve asi:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
 
function Main()        
 
   local oDlg,oGet      
   local cSeek:= Space(100)

   DEFINE DIALOG oDlg TITLE "Test"        
 
   @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                     BITMAP "..\bitmaps\delete.bmp";
                      ACTION (cSeek    := Space( 100 ),;
                                      oGet:refresh()) ;
                 
                       oGet:lBtnTransparent :=.t.
                       oGet:bChange  := { ||ChangeGetBtn(oGet,cseek) }
                       ACTIVATE DIALOG oDlg CENTERED  ;
                       ON INIT ( oGet:cBmpName:="",oGet:oBtn:hide())
return nil
//----------------------------------------------------------------------//
Function ChangeGetBtn(oGet,cseek)
oGet:assign()
   IF EMPTY( oGet:cText )
      oGet:oBtn:hide()
   ELSE
      oGet:oBtn:show()
      oGet:cBmpName:="..\bitmaps\delete.bmp"
   ENDIF
return .t.
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: show /hide a bitmap on a get

Postby Silvio.Falconi » Fri Feb 24, 2023 12:06 pm

thanks
LET ME WRITE ONLY ONE cR
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: show /hide a bitmap on a get

Postby Cgallegoa » Sat Feb 25, 2023 3:45 am

Code: Select all  Expand view  RUN
#include "FiveWin.ch"
 
function Main()        
 
   local oDlg,oGet      
   local cSeek:= Space(100)

   DEFINE DIALOG oDlg TITLE "Test"        
 
       @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                 BITMAP "d:\fwh\bitmaps\delete.bmp" ;
                 ACTION ( cSeek := Space( 100 ),;
                               ChangeGetBtn(oGet,cseek),;    // ************* //
                               oGet:SetPos(0))    // ************* //

       oGet:lBtnTransparent :=.t.
       oGet:bChange  := { || oGet:Assign() , ChangeGetBtn(oGet,cseek) }
       oGet:bKeyDown := { || oGet:Assign() , ChangeGetBtn(oGet,cseek)  }

       @ 50,10 BUTTON "Exit" OF oDlg ACTION oDlg:End() PIXEL

   ACTIVATE DIALOG oDlg CENTERED  ;
      ON INIT ( oGet:cBmpName:="" , oGet:oBtn:hide())
return nil
//----------------------------------------------------------------------//

Function ChangeGetBtn(oGet,cseek)

   oGet:Assign()  // ************* //

   IF EMPTY( cseek )
      oGet:oBtn:hide()
      oGet:cBmpName:=""
   ELSE
      oGet:oBtn:show()
      oGet:cBmpName:="d:\fwh\bitmaps\delete.bmp"
   ENDIF

return .t.
 //----------------------------------------------------------------------//
Saludos,

Carlos Gallego

*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Cgallegoa
 
Posts: 494
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador

Re: show /hide a bitmap on a get

Postby Silvio.Falconi » Sun Feb 26, 2023 5:15 pm

Cgallegoa wrote:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"
 
function Main()        
 
   local oDlg,oGet      
   local cSeek:= Space(100)

   DEFINE DIALOG oDlg TITLE "Test"        
 
       @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                 BITMAP "d:\fwh\bitmaps\delete.bmp" ;
                 ACTION ( cSeek := Space( 100 ),;
                               ChangeGetBtn(oGet,cseek),;    // ************* //
                               oGet:SetPos(0))    // ************* //

       oGet:lBtnTransparent :=.t.
       oGet:bChange  := { || oGet:Assign() , ChangeGetBtn(oGet,cseek) }
       oGet:bKeyDown := { || oGet:Assign() , ChangeGetBtn(oGet,cseek)  }

       @ 50,10 BUTTON "Exit" OF oDlg ACTION oDlg:End() PIXEL

   ACTIVATE DIALOG oDlg CENTERED  ;
      ON INIT ( oGet:cBmpName:="" , oGet:oBtn:hide())
return nil
//----------------------------------------------------------------------//

Function ChangeGetBtn(oGet,cseek)

   oGet:Assign()  // ************* //

   IF EMPTY( cseek )
      oGet:oBtn:hide()
      oGet:cBmpName:=""
   ELSE
      oGet:oBtn:show()
      oGet:cBmpName:="d:\fwh\bitmaps\delete.bmp"
   ENDIF

return .t.
 //----------------------------------------------------------------------//


It run ok onky when I write a text after I delete it init from ++ space


1) write a text

Image


2) press the button and the text is deleted

Image

3) I insert a new text , but it init from position 0 + 4

Image

then if I delete also , the text init from 0 position + 8
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm

Re: show /hide a bitmap on a get

Postby Cgallegoa » Mon Feb 27, 2023 8:43 pm

Silvio:

Code: Select all  Expand view  RUN
    @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                 BITMAP "d:\fwh\bitmaps\delete.bmp" ;
                 ACTION ( cSeek := Space( 100 ),;
                               ChangeGetBtn(oGet,cseek),;    // ************* //
                               oGet:SetPos(0))    // ***  oGet:SetPos(0) puts de curson in pos 0 after click on Del bitmap *** //
 

Working ok on xHarbour and FWH 20.07
Image
Saludos,

Carlos Gallego

*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Cgallegoa
 
Posts: 494
Joined: Sun Oct 16, 2005 3:32 am
Location: Quito - Ecuador

Re: show /hide a bitmap on a get

Postby Silvio.Falconi » Tue Feb 28, 2023 9:06 am

Cgallegoa wrote:Silvio:

Code: Select all  Expand view  RUN
    @ 1, 1 GET oGet VAR cSeek SIZE 50,10 PIXEL OF oDlg  ;
                 BITMAP "d:\fwh\bitmaps\delete.bmp" ;
                 ACTION ( cSeek := Space( 100 ),;
                               ChangeGetBtn(oGet,cseek),;    // ************* //
                               oGet:SetPos(0))    // ***  oGet:SetPos(0) puts de curson in pos 0 after click on Del bitmap *** //
 

Working ok on xHarbour and FWH 20.07
Image


now run ok only I have a xbrowse search and before not run ok
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: 7066
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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