>The extra save/restore button would also be a great thing....
I made it many years ago (2014) but it no one seems to like it
release for a oldest xbrowse
sample
:aCols2Hide := {1,2,3,4,5,6,13,14,15,16}
:aDefaultCols := {1,2,3,4,5,6,13,14,15,16}
oGrid:aDefaultCols :=oGrid:GetDisplayCols()
oGrid:SetUserCols()
- Code: Select all Expand view RUN
DATA aCols2Hide AS ARRAY INIT Array(0)
DATA aDefaultCols INIT ARRAY( 0 )
DATA aPreviousCols INIT ARRAY( 0 )
METHOD SetUserCols(lDefCols)
METHOD SetColumns( nRow, nCol, nFlags ) CLASS TXBrowse
local oMenu, oCol
local nFor, nLen
local aCols, lDefCols
local bPrevCols := {|| ::aPreviousCols := ::GetDisplayCols() }
local bUserCols := {|| aCols := if(lDefCols, ::aDefaultCols, ::aPreviousCols ) ,;
if( Len( aCols ) != 0, AEval( ::aCols, { |o| If( AScan( aCols, o:nCreationOrder ) > 0, o:Show(),o:Hide() ) } ) ,)}
nLen := Len( ::aCols )
MENU oMenu POPUP
if ::l2007
if WndMain() != nil .and. WndMain():oMenu != nil .and. WndMain():oMenu:l2010
oMenu:l2010 := .t.
else
oMenu:l2007 := .t.
endif
endif
if Len( ::aDefaultCols ) != 0
Menuitem "Settings Default" ACTION ( Eval( bPrevCols ), lDefCols:=.t., Eval( bUserCols ), ::Refresh() )
Menuitem "All columns" ACTION ( Eval( bPrevCols ), AEval( ::aCols, { |o| o:lHide := .f. } ) , ::Refresh() )
Menuitem "Previous Columns" ACTION ( lDefCols:=.f., Eval( bUserCols ), ::Refresh() )
SEPARATOR
endif
for nFor := 1 to nLen
oCol := ::aCols[ nFor ]
MenuAddItem( oCol:cHeader, , !oCol:lHide, ;
( Len(::aDisplay) != 1 .or. oCol:nPos != 1 ), ;
GenMenuBlock( ::aCols, nFor ) )
next
ENDMENU
ACTIVATE POPUP oMenu AT nRow, nCol OF Self
return nil
METHOD SetUserCols(lDefCols) CLASS TXBrowse
local aCols
DEFAULT lDefCols := .t.
aCols := if(lDefCols, ::aDefaultCols, ::aPreviousCols )
if Len( aCols ) != 0
AEval( ::aCols, { |o| If( AScan( aCols, o:nCreationOrder ) > 0, o:Show(),o:Hide() ) } )
endif
Return nil
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