Page 1 of 1
oBrowse:colcount hidden columns
Posted: Mon Jun 17, 2024 5:13 am
by skiman
Hi,
I have a browse with hidden columns. How can I get ALL the columns of the browse? Seems as colcount doesn't show the hidden columns.
Re: oBrowse:colcount hidden columns
Posted: Mon Jun 17, 2024 6:47 am
by Tom
A browse can't hide columns. If you use the HIDE clause with eXpress++, the columns are deleted and added again, depending on the result of the HIDE-clause.
Re: oBrowse:colcount hidden columns
Posted: Mon Jun 17, 2024 11:53 pm
by SlavkoDam
Hi,
Tom, browse columns can be hidden/shown, but not in eXpress++. Roger use simple oCol:hide()/oCol:show() for that, but it does not do the task well. I described how to do that correctly in this post:
viewtopic.php?f=2&t=3211
Cris, to get all columns in a browser you can use this: oCol:setParent():childList(), where oCol is any column in a browser.
You can also use this: oBrw:aColumns, where :aColumns is a READONLY variable.
Slavko
Re: oBrowse:colcount hidden columns
Posted: Tue Jun 18, 2024 4:19 am
by skiman
Hi Tom, Slavko,
Thanks for the insights.
Re: oBrowse:colcount hidden columns
Posted: Wed Jun 19, 2024 5:07 pm
by rdonnay
I added the ability to collapse and restore columns in SqlQuery.prg.
Your columns would need to first use the DCBROWSECOL .. SUBCLASS 'DD_XbpBrowseFiltered()'
Code: Select all
CLASS DD_XbpColumnFiltered FROM DC_XbpColumnFiltered
EXPORTED:
VAR nColumnWidth
VAR isCollapsed
INLINE METHOD Init(a,b,c,d,e,f,g)
LOCAL oColumn
::isCollapsed := .f.
oColumn :=::DC_XbpColumnFiltered:init(a,b,c,d,e,f,g)
::isColumnConfigEnabled := .t.
RETURN oColumn
* -----------
INLINE METHOD Collapse( lResizeBrowse )
DEFAULT lResizeBrowse := .t.
IF !::isCollapsed
::nColumnWidth := ::currentSize()[1]
::setSize({0,::currentSize()[2]})
::hide()
::isCollapsed := .t.
IF lResizeBrowse
::parent:setSize(::parent:currentSize())
ENDIF
ENDIF
RETURN self
* ------------
INLINE METHOD Restore( lResizeBrowse )
DEFAULT lResizeBrowse := .t.
IF ::isCollapsed
::setSize({::nColumnWidth,::currentSize()[2]})
::show()
::isCollapsed := .f.
IF lResizeBrowse
::parent:setSize(::parent:currentSize())
ENDIF
ENDIF
RETURN self
ENDCLASS