Page 1 of 1

how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 10:37 am
by Jimmy
hi,

i have work TExplorerBar() 1st Time and i begin to understand how it work
but there is no Dokumentation even Fivewin-Wiki about TExplorerBar()

Question
how get Event from TExplorerBar() when "collaps" a Panel ?
Image
Code: Select all  Expand view
  oExBar = TExplorerBar():New()
   oPanel1 = oExBar:AddPanel( "One", "..\bitmaps\32x32\people.bmp" )

full Sample CODE you find here
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=44043

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 12:28 pm
by Silvio.Falconi
See checkscroll method

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 12:57 pm
by Antonio Linares
Jimmy wrote:hi,

i have work TExplorerBar() 1st Time and i begin to understand how it work
but there is no Dokumentation even Fivewin-Wiki about TExplorerBar()

Question
how get Event from TExplorerBar() when "collaps" a Panel ?
Image
Code: Select all  Expand view
  oExBar = TExplorerBar():New()
   oPanel1 = oExBar:AddPanel( "One", "..\bitmaps\32x32\people.bmp" )

full Sample CODE you find here
https://forums.fivetechsupport.com/viewtopic.php?f=3&t=44043

Dear Jimmy,

TExplorerBar has no currently support for such event but it can be easily implemented from:

METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TTaskPanel

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 2:33 pm
by Jimmy
hi Silvio,
Silvio.Falconi wrote:See checkscroll method

thx for Answer

but how to "react" to call Method ChekScroll() :?:

when "click" there will be WM_LBUTTONDOWN / WM_LBUTTONUP Event fired
for this we have Codeblock-Slot like in c:\fwh\samples\testmmd.prg
Code: Select all  Expand view
  oWndMOUSE:bLClicked    = { | nRow, nCol, nFlags | oWndMOUSE:Say( 2, 2,  "LButtonDown" ) }
   oWndMOUSE:bLButtonUp   = { | nRow, nCol, nFl8ags | oWndMOUSE:Say( 2, 2, "LButtonUp    " ) }

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 2:53 pm
by Jimmy
hi Antonio,
Antonio Linares wrote:TExplorerBar has no currently support for such event but it can be easily implemented from:

METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TTaskPanel

thx for Answer

there is in CLASS TTaskPanel
Code: Select all  Expand view
  DATA   lCollapsed      INIT .F.

and it will be assign Value in
Code: Select all  Expand view
METHOD LButtonUp(nRow, nCol, nFlags ) CLASS TTaskPanel

but there is no Codeblock-Slot like bLButtonUp which will "react" when click on "Collaps" :(
i do not understand "when" to call LButtonUp()

Question : where are Titlebar Resource of TTaskPanel() come from :?:

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 6:12 pm
by Antonio Linares
Dear Jimmy,

On CLASS TTaskPanel FROM TControl add this DATA:

DATA bOnCollapse

and then add this code at the bottom of METHOD LButtonUp( nRow, nCol, nFlags ) CLASS TTaskPanel:
Code: Select all  Expand view
     ::oWnd:CheckScroll()

      if ! Empty( ::bOnCollapse )   // new
         Eval( ::bOnCollapse, Self )   // new
      endif    // new
   endif

We are adding these changes for next FWH build

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Sat Feb 24, 2024 6:32 pm
by Jimmy
hi Antonio,

Codeblock-Slot like these we need, thx
but how is METHOD LButtonUp() called when i click to collaps/enlarge :?:

Request :
also need for DragDrop
Code: Select all  Expand view
METHOD LButtonUp( nRow, nCol )

include DATA lDrag and ::Capture()

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Mon Feb 26, 2024 1:04 am
by Jimmy
hi,

i got bOnCollapse working :D
Code: Select all  Expand view
  oPanel1:bOnCollapse :=  { | | CheckCollapse(oPanel1,cMsg,1) }
   oPanel2:bOnCollapse :=  { | | CheckCollapse(oPanel2,cMsg,2) }
   oPanel3:bOnCollapse :=  { | | CheckCollapse(oPanel3,cMsg,3) }

i don´t know how but METHOD LButtonUp will be "automatic" called which include
Code: Select all  Expand view
     if ! Empty( ::bOnCollapse )   // new
         Eval( ::bOnCollapse, Self )   // new
      endif    // new

so this is my Solution
Code: Select all  Expand view
PROCEDURE CheckCollapse(oPanel,cMessage,nPanel)
LOCAL n, yPos := 0
LOCAL aDim
local oFonttext

   DEFINE FONT oFonttext NAME "Verdana" SIZE 0, -12

   IF oPanel:lCollapsed = .T.
      // do nothing
   ELSE
      DO CASE
         CASE nPanel = 1
            // fix Size
            oPanel:nHeight      := 80
         CASE nPanel = 2
            aDim = GetLabelDim( oPanel:hWnd, alltrim(cMessage), oFonttext:hFont )
            oPanel:nHeight     := aDim[ 2 ] + (3 * (oFonttext:nHeight() +2) )
            oPanel:nBodyHeight := oPanel:nHeight - oPanel:nTitleHeight
         CASE nPanel = 3
            // fix Size
            oPanel:nHeight      := 80
      ENDCASE
   ENDIF

   // re-position
   for n= 1 to Len( oExbar:aPanels )

   //  move Panel to new Position
       oExbar:aPanels[n]:Move(yPos)

       oExbar:aPanels[n]:nBodyHeight := oExbar:aPanels[n]:nHeight - oExbar:aPanels[n]:nTitleHeight

       oExbar:aPanels[n]:CoorsUpdate()
       oExbar:aPanels[n]:UpdateRegion()

       oExbar:CheckScroll()
       yPos += oExbar:aPanels[n]:nHeight + 20
   next

   RELEASE oFonttext
*   oExbar:Refresh()
   invalidateRect(oExbar:hwnd,0, .T. )

RETURN

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Tue Feb 27, 2024 11:43 am
by Silvio.Falconi
a question

yPos := 0

this is no good because the first panel can init from 18 and not from 0 row

I not found the exact variable perhaps ::nTop ?

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Tue Feb 27, 2024 10:40 pm
by Jimmy
hi Silvio,
Silvio.Falconi wrote:a question

yPos := 0

this is no good because the first panel can init from 18 and not from 0 row

I not found the exact variable perhaps ::nTop ?

as i can say it is 1st Position of "Body" from TExplorerBar() where i oExBar:AddPanel()

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Wed Feb 28, 2024 8:37 am
by Silvio.Falconi
Jimmy wrote:hi Silvio,
Silvio.Falconi wrote:a question

yPos := 0

this is no good because the first panel can init from 18 and not from 0 row

I not found the exact variable perhaps ::nTop ?

as i can say it is 1st Position of "Body" from TExplorerBar() where i oExBar:AddPanel()


yes but the first position of First TaskPanelPanel is never 0

Please try fwh\samples\explbar.prg and see it the first taskpanel not is on 0 row

Re: how get Event from TExplorerBar() when "collaps" a Panel ?

PostPosted: Wed Feb 28, 2024 11:54 pm
by Jimmy
hi Silvio,

you are Right that Original CLASS TTaskPanel() Layout are
Code: Select all  Expand view
  DATA   nTopMargin      INIT 16

but i just show Technic how to get Event, when Collaps, and "move" Panels to new Position
where i start from TOP = 0 in my Layout

it is up to you to change Layout like SPACE between TTaskPanel()
Code: Select all  Expand view
  yPos +=aPanels[n]:nHeight + 20


---

to enhance CLASS TExplorerBar we can look into CLASS TExplorerList
Code: Select all  Expand view
METHOD DelChilds( uVal ) CLASS TExplorerList
METHOD DelItem( uVal ) CLASS TExplorerList