Page 1 of 1

Erase btnbmp from another btnbmp, the space remains

Posted: Mon Mar 23, 2020 5:49 pm
by Silvio.Falconi
I put some small btns inside a big btnbmp

when I go to delete one, the space remains

How can I go about refreshing the big btnbmp so I can't see the space created?

I realize that it is difficult to understand so I thought I would like to make you a small movie to show you what my problem is

Image

I hope you help me, so I create a small test to try

Code: Select all

 
#include "fivewin.ch"

#define COLOR_PRESSED1 nRGB(255,165,0)

Function test()
  Local oDlg,aBtnBig[1],oBtnSmall[2]
  Local oInvoice // Invoice


Define Dialog oDlg size 750,400

@ 120,20  button  "Insert products" size 45,18 pixel of oDlg;
action  CreateButtonKids(aBtnBig[1],oBtnSmall)

activate dialog oDlg ;
     On init oInvoice:=CreatePanel(oDlg,aBtnBig)
return nil


//-------------------------------------------//
Function CreatePanel(oDlg,aBtnBig)
Local nRow:= 10
Local ncol:= 10
local oPanel
local k

   oPanel   := TScrollPanel():New( 10,10,180,700,oDlg, .t. )
   oPaneL:nRightMargin     := 10
   oPanel:nBottomMargin    := 60
   oPanel:WinStyle(WS_BORDER, .t.)


         For k=1 to Len(aBtnBig)


       @ nRow,ncol BTNBMP aBtnBig[k];
       SIZE 650, 120 PIXEL;
         FLAT RIGHT;
        PROMPT "BIG" of oPanel

       aBtnBig[k]:bAction    := { |aBtnBig,k| aBtnBig:Toggle()}
       aBtnBig[k]:bClrGrad := { |l,oBtn| If( oBtn:lPressed, COLOR_PRESSED1,CLR_WHITE   ) }
         nRow+=120+2
       nCol:=10
    next
     oPanel:SetRange()
   return oPanel

//-------------------------------------------//

Function CreateButtonKids(oBtnBig,oBtnSmall)
Local nRow:= 10
Local ncol:= 210

       @ nRow,ncol BTNBMP oBtnSmall[1];
       SIZE 95, 95 PIXEL;
         FLAT RIGHT;
        PROMPT "small1" of oBtnBig;
          ACTION ::ShowPopUp( { |oBtn| BtnPopMenu( oBtn,oBtnSmall[1]) } )

       ncol+=97

       @ nRow,ncol BTNBMP oBtnSmall[2];
       SIZE 95, 95 PIXEL;
         FLAT RIGHT;
        PROMPT "small2" of oBtnBig ;
           ACTION ::ShowPopUp( { |oBtn| BtnPopMenu( oBtn,oBtnSmall[1]) } )
       return nil


//----------------------------------------------------------------------------------//
 function BtnPopMenu( oBtn,oBmp )

   local oPop
   local n

   MENU oPop POPUP
        MENUITEM "Elimina" ACTION (oBtn:destroy(), oBmp:refresh())
        MENUITEM "Modifica Prezzo" action nil
   ENDMENU
   return oPop
//----------------------------------------------------------------------------------//
 

Re: Erase btnbmp from another btnbmp, the space remains

Posted: Thu Mar 26, 2020 1:07 pm
by Silvio.Falconi
Amy solution please