Add a new taskPanel on Explorerbar ( on line)

Add a new taskPanel on Explorerbar ( on line)

Postby Silvio.Falconi » Sun Feb 25, 2024 5:06 pm

At init I have

Image

and I wish insert a taskpanel after the first taskpanel on line ( I wish the final user can add the second Panel on line)

Image

I not Found a Solution

I created a test where at init I build the oExbar from an array aData and if the 4th paramter is false it not create the taskPanel

the final use when click the link "Create Second Panel" the procedure must destroy all panels and recreate all

to destroy Panel I tried with destroy(9 and end() method but it seem not Know these commands and I cannot destroy the previous panels before to create all

this is the small test

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

//----------------------------------------------------------------------------//
//
function Main()

   local oWnd, oExBar
                    // name,Bitmap,Len,active
    local  adata:={  {"One", "..\bitmaps\32x32\case.bmp",100,.t.  } ,;
                     {"two", "..\bitmaps\32x32\case.bmp",100,.f.  } ,;
                     {"Three", "..\bitmaps\32x32\case.bmp",100,.t.} ,;
                     {"Four", "..\bitmaps\32x32\case.bmp",100,.t. } }

    local aPanels:= array(4)

   // xbrowser adata

   DEFINE WINDOW oWnd TITLE "FWH Class TExplorerBar"

   oWnd:SetSize( 350, 600 )

   oExBar = TExplorerBar():New()

   // create the taskpanels
   Crea_Panels(oExBar,aData,aPanels)


   oWnd:oClient = oExBar

   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//
// Set and create the second  taskPanel
Function Crea_Second_Panel(oExBar,aData,aPanels)

   aData[2][4]:=.t.   //change the value

   Refresh_oExbar(oExBar,aData,aPanels)

 return nil

//----------------------------------------------------------------------------//
 // create the taskPanels
 Function Crea_Panels(oExBar,aData,aPanels)
   local bClick := { | o | MsgInfo( o:GetText() ) }
   local bCreateSecond := { ||Crea_Second_Panel(oExBar,aData,aPanels)  }

    For n= 1 to Len(adata)
       IF aData[n][4]
          aPanels[n]:=  oExBar:AddPanel( aData[n][1], aData[n][2],aData[n][3] )
        Endif
     Next

     aPanels[1]:AddLink( "First item", bClick, "..\bitmaps\16x16\additem.bmp" )
     aPanels[1]:AddLink( "Create Second Panel", bCreateSecond, "..\bitmaps\16x16\copy.bmp" )

 return nil

 //refresh the explorerbat
Function Refresh_oExbar(oExBar,aData,aPanels)

   For n= 2 to Len(adata)
        aPanels[n]:=NIL //end() destroy()
     Next

   oExBar:refresh()

  Crea_Panels(oExBar,aData,aPanels)

  return nil

 


If I tried with Destroy I have this error

For n= 2 to Len(adata)
aPanels[n]:destroy()
Next




Code: Select all  Expand view
Error occurred at: 02/25/24, 18:05:43
   Error description: Error BASE/1004  No exported method: DESTROY
   Args:
     [   1] = U  




IF I make

oExBar:CloseAll()

and then

aPanels[3]:end()
aPanels[4]:end()




I have this result

Image

as you can see the third and fourth panels are not destroyed
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Add a new taskPanel on Explorerbar ( on line)

Postby Silvio.Falconi » Mon Feb 26, 2024 8:50 am

New Release


Image

As you can see it might work except it doesn't delete previous panels correctly
that remain below


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

//----------------------------------------------------------------------------//
//
function Main()

   local oWnd, oExBar
                    // name,Bitmap,Len,active
    local  adata:={  {"One", "..\bitmaps\32x32\case.bmp",100,.t.  } ,;
                     {"two", "..\bitmaps\32x32\case.bmp",100,.f.  } ,;
                     {"Three", "..\bitmaps\32x32\case.bmp",100,.t.} ,;
                     {"Four", "..\bitmaps\32x32\case.bmp",100,.t. } }

    local aPanels:= array(4)
    local lInit:=.t.
   // xbrowser adata

   DEFINE WINDOW oWnd TITLE "FWH Class TExplorerBar"

   oWnd:SetSize( 350, 600 )

   oExBar = TExplorerBar():New()

   // create the taskpanels
   Crea_Panels(oExBar,aData,aPanels,@lInit)


   oWnd:oClient = oExBar

   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//
// Set and create the second  taskPanel
Function Crea_Second_Panel(oExBar,aData,aPanels)

   aData[2][4]:=.t.   //change the value

   Crea_Panels(oExBar,aData,aPanels,.f.,1)

   Refresh_Panels(oExbar,aPanels)

 return nil

//----------------------------------------------------------------------------//
 // create the taskPanels
 Function Crea_Panels(oExBar,aData,aPanels,lInit, nExcept)
   local bClick := { | o | MsgInfo( o:GetText() ) }
   local bCreateSecond := { ||Crea_Second_Panel(oExBar,aData,aPanels)  }


   DEFAULT nExcept := 0

 If !linit
    Erase_Panels(aPanels,oExBar,1)
 Endif

    For n= nExcept + 1  to Len(adata)
       IF aData[n][4]
          aPanels[n]:=  oExBar:AddPanel( aData[n][1], aData[n][2],aData[n][3] )
        Endif
     Next

  If lInit
     aPanels[1]:AddLink( "First item", bClick, "..\bitmaps\16x16\additem.bmp" )
     aPanels[1]:AddLink( "Create Second Panel", bCreateSecond, "..\bitmaps\16x16\copy.bmp" )
  Endif

  lInit:=.f.
 return nil


//----------------------------------------------------------------------//
Function Erase_Panels(aPanels,oExBar,nExcept)
   local oItem,n

    DEFAULT nExcept := 0

     oExBar:CloseAll()

    for n = nExcept + 1 to Len( aPanels )
         oItem := aPanels[ n ]
         if oItem:ClassName == "TTASKPANEL"
                  aPanels[ n ]:Destroy()
         endif
      Next

      Refresh_Panels(oExbar,aPanels,1)

  return nil
//--------------------------------------------------------------------//
Function Refresh_Panels(oExbar,aPanels,nExcept)
   local yPos:=0,n,oItem

    DEFAULT nExcept := 0
       
    for n = nExcept + 1 to Len( aPanels )
       oItem := aPanels[ n ]
         if oItem:ClassName == "TTASKPANEL"
   //  move Panel to new Position
              aPanels[n]:Move(yPos)
              aPanels[n]:nBodyHeight += aPanels[n]:nHeight - aPanels[n]:nTitleHeight
              aPanels[n]:CoorsUpdate()
              aPanels[n]:UpdateRegion()
              oExbar:CheckScroll()
               yPos +=aPanels[n]:nHeight + 20
        Endif
   next
   oExbar:Refresh()
   return nil
//--------------------------------------------------------------------//
 


it might work except that the Destroy method doesn't delete the taskpanels correctly

NOTICE
panel 1 is always present and is never deleted
so when I delete the panels I delete them starting from the second
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: Add a new taskPanel on Explorerbar ( on line)

Postby Silvio.Falconi » Tue Feb 27, 2024 11:46 am

I think we would need a new method directly in the texplorerbar class to insert taskpanel in x position
I sent to Linares my Idea for two new methods
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: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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

cron