Page 1 of 1

Twbrowse .. hide a listbox column

Posted: Mon Dec 17, 2007 2:45 pm
by Rick Lipkin
To All

I have a routine that goes out and creates a database structure that is a variable number of fields .. I use the generic code :

REDEFINE LISTBOX oBrow FIELDS ;
ID 111 of oEMP

to view the data .. I do know that I want to HIDE the first column .. is that possible with Twbrowse or with Hernan's Twbrowse ??

Thanks
Rick Lipkin

Posted: Mon Dec 17, 2007 3:03 pm
by nageswaragunupudi
With xBrowse it is possible

Code: Select all

oBrw  := TXBrowse():New( oDlg )
oBrw:SetRDD( .T. )   .or. oBrw:SetADO( oRs )
oBrw:CreateFromResource( nID )
oBrw:aCols[1]:Hide()
ACTIVATE DIALOG oDlg

Posted: Mon Dec 17, 2007 3:04 pm
by Antonio Linares
Rick,

DATA bLine is a codeblock that returns an array with the columns data to display. You may call a function and the function will return the desired columns:

Code: Select all

oBrw:bLine = { || GetColumns( lHideFirst ) }

function GetColumns( lHideFirst )

   if lHideFirst
      return { FieldGet( 2 ), FieldGet( 3 ), FieldGet( 4 ) }
   else
      return { FieldGet( 1 ), FieldGet( 2 ), FieldGet( 3 ), FieldGet( 4 ) }
   endif

return nil

Posted: Mon Dec 17, 2007 4:54 pm
by Rick Lipkin
Thanks .. appreciate the answers ..

Rick