Maurizio
Posts: 826 Joined: Mon Oct 10, 2005 1:29 pm
Contact:
Post
by 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
#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 "..\b itmaps\1 6x16\n ew.bmp" FLAT ; ACTION MsgInfo ( "New" ) ; TOOLTIP "Creates a new document" DEFINE BUTTON OF oBar FILENAME "..\b itmaps\1 6x16\f loppy.bmp" FLAT ; ACTION MsgInfo ( Time( ) ) TOOLTIP "Saves this document" DEFINE BUTTON OF oBar FILENAME "..\b itmaps\1 6x16\E xit.bmp" FLAT ; ACTION oWnd:End ( ) TOOLTIP "Exit this app" GROUP oBar:Del ( 2 ) ACTIVATE WINDOW oWnd return nil
Maurizio
karinha
Posts: 7935 Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:
Post
by karinha » Thu Nov 04, 2021 3:08 pm
Code: Select all | Expand
// \samples\MAURIZIO.PRG #Include "FiveWin.ch" STATIC oBar, oBtn1, oBtn2, oBtn3STATIC 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 "..\b itmaps\1 6x16\n ew.bmp" FLAT ; ACTION ( mDeleteBut( ) ) ; TOOLTIP "Delete a Button" DEFINE BUTTON oBtn2 OF oBar FILENAME "..\b itmaps\1 6x16\f loppy.bmp" FLAT ; ACTION MsgInfo ( Time( ) ) TOOLTIP "Saves this document" DEFINE BUTTON oBtn3 OF oBar FILENAME "..\b itmaps\1 6x16\E xit.bmp" FLAT ; ACTION oWnd:End ( ) TOOLTIP "Exit this app" GROUP ACTIVATE WINDOW oWndRETURN 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
Maurizio
Posts: 826 Joined: Mon Oct 10, 2005 1:29 pm
Contact:
Post
by 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
nageswaragunupudi
Posts: 10721 Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:
Post
by 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
METHOD Del( nPos ) CLASS TBar local n local lGroup:= ::aControls [ nPos ] :lGroup ADel( ::aControls , nPos )
Modify as:
Code: Select all | Expand
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