I'm trying to hide/show a column in a browse. I don't succeed to get this working as it should.
I can hide, but when I want to show it again, it looks as another column is overwritten. I tried refreshall, forcestable() but it doens't work as expected.
Below is my sample code which demonstrates the problem.
- You can hide column 2.
- When you want to show it again, it comes instead of column1 which looks as it disappears.
Code: Select all
function testbrowse()
****************************************
Local getlist := {} , oBrowse
Local aTestData := { {"abc","xyz",123} }
Local lDisplay := .T.
@ 1,1 dcbrowse oBrowse data atestdata SIZE 40,10 FIT
DCBROWSECOL ELEMENT 1 HEADER "Col 1 " PARENT oBrowse WIDTH 10
DCBROWSECOL ELEMENT 2 HEADER "Col 2 " PARENT oBrowse WIDTH 10 HIDE {|| !lDisplay }
DCBROWSECOL ELEMENT 3 HEADER "Col 3 " PARENT oBrowse WIDTH 10
@12,10 dcpushbuttonxp ;
CONFIG amain(2,17) ;
CAPTION 'SHOW Col 2' notabstop ;
SIZE 20,1 ;
ACTION {||lDisplay := .T. ,DC_GetRefresh(getlist), oBrowse:refreshall(), setAppfocus(oBrowse) }
@12,32 dcpushbuttonxp ;
CONFIG amain(2,17) ;
CAPTION 'HIDE Col 2' notabstop ;
SIZE 20,1 ;
ACTION {||lDisplay:=.F. ,DC_GetRefresh(getlist),obrowse:gotop(),oBrowse:refreshall(), oBrowse:forceStable(), setAppfocus(oBrowse) }
DCREAD GUI ;
TITLE 'Test Hide/Show Col' FIT
return nil