Error in Tbar

Error in Tbar

Postby Maurizio » Thu Nov 04, 2021 2:01 pm

Hello
if I delete a button in TBAR, the button is deleted but when the button following the deleted one has the focus I see the BMP of the deleted button.


https://drive.google.com/file/d/1J0lQ9ln18UKuYMI1XLI26SCoyvcq5XRt/view?usp=sharing



Code: Select all  Expand view  RUN
#include "FiveWin.ch"
//----------------------------------------------------------------------------//

function Main()

   local oIco, oBar, oBmp ,oWnd

   
   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "FiveWin sample" ;
      COLOR "B/W"
     

   DEFINE BUTTONBAR oBar _3D SIZE 60, 60 OF oWnd

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT ;
      ACTION MsgInfo( "New" ) ;
      TOOLTIP "Creates a new document"

 
   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\floppy.bmp" FLAT ;
      ACTION MsgInfo( Time() ) TOOLTIP "Saves this document"

   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP

 
  oBar:Del(2)
 

   
   ACTIVATE WINDOW oWnd

return nil

 

Maurizio
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error in Tbar

Postby nageswaragunupudi » Thu Nov 04, 2021 2:16 pm

We are looking into this.
Regards

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

Re: Error in Tbar

Postby karinha » Thu Nov 04, 2021 3:08 pm

Code: Select all  Expand view  RUN

// \samples\MAURIZIO.PRG

#Include "FiveWin.ch"

STATIC oBar, oBtn1, oBtn2, oBtn3

STATIC lNotLook := .T.

FUNCTION Main()

   LOCAL oIco, oBmp, oWnd
   
   DEFINE WINDOW oWnd FROM 1, 1 TO 22, 75 ;
      TITLE "FiveWin: Delete a Button" ;
      COLOR "B/W"

   DEFINE BUTTONBAR oBar _3D SIZE 60, 60 OF oWnd

   DEFINE BUTTON oBtn1 OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT    ;
      ACTION( mDeleteBut() )                                               ;
      TOOLTIP "Delete a Button"
 
   DEFINE BUTTON oBtn2 OF oBar FILENAME "..\bitmaps\16x16\floppy.bmp" FLAT ;
      ACTION MsgInfo( Time() ) TOOLTIP "Saves this document"

   DEFINE BUTTON oBtn3 OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT   ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP

    ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION mDeleteBut() // Delete Button for Maurizio.

   IF lNotLook // := .T.

      oBar:Del( 2 )

      oBtn2:Hide()

      oBar:BtnAdjust()
      oBar:Refresh()

      lNotLook := .F.

   ELSE

      ? "WOW!! Invisible Button - Number 2"

   ENDIF

RETURN NIL

// fin / end
 


Regards, saludos.
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: Error in Tbar

Postby Maurizio » Fri Nov 05, 2021 8:03 am

Grazie Karinha

Your workaround works
Let's see if Rao solves the problem in the tBar class .

Maurizio
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error in Tbar

Postby nageswaragunupudi » Fri Nov 05, 2021 7:08 pm

Will you both try this fix and give your valuable feedback?

Present code in bar.prg
Code: Select all  Expand view  RUN
METHOD Del( nPos ) CLASS TBar

   local n
   local lGroup:= ::aControls[ nPos ]:lGroup

   ADel( ::aControls, nPos )
 


Modify as:
Code: Select all  Expand view  RUN
METHOD Del( nPos ) CLASS TBar

   local n
   local lGroup:= ::aControls[ nPos ]:lGroup

   ::aControls[ nPos ]:Hide()  // insert these
   ::aControls[ nPos ]:End()   // two lines
   ADel( ::aControls, nPos )
 
Regards

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

Re: Error in Tbar

Postby Maurizio » Mon Nov 08, 2021 7:50 am

Thanks Rao
with your modifications it works :D

Maurizio
www.nipeservice.com
User avatar
Maurizio
 
Posts: 825
Joined: Mon Oct 10, 2005 1:29 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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