MOGSY Posted September 17, 2020 Share Posted September 17, 2020 Hi How is possible to hide columns in UniDbGrid? I have tried the following and is not working. for II := 0 to unidbgrid.Columns.Count - 1 do begin if (unidbgrid.Columns.Items[II].FieldName = 'ABC') or (unidbgrid.Columns.Items[II].FieldName = 'EFG') then unidbgrid.Columns.Items[II].Visible := True else unidbgrid.Columns.Items[II].Visible := True; end; Thanks Quote Link to comment Share on other sites More sharing options...
x11 Posted September 17, 2020 Share Posted September 17, 2020 9 minutes ago, MOGSY said: unidbgrid.Columns.Items[II].Visible := True else dbgAtoZ.Columns.Items[II].Visible := True; True or True? unidbgrid or dbgAtoZ ? Quote Link to comment Share on other sites More sharing options...
MOGSY Posted September 17, 2020 Author Share Posted September 17, 2020 sorry about the copy paste! Quote Link to comment Share on other sites More sharing options...
irigsoft Posted September 17, 2020 Share Posted September 17, 2020 I Use this to create and setup Columns: MyColumn := TuniDBGrid (SelDBGrid).Columns.Add; MyColumn.Font.Size := uniMainModule.ControlsFontSize; MyColumn.Title.Font.Size := uniMainModule.ControlsFontSize; MyColumn.Title.Alignment := taCenter; MyColumn.Title.Caption := FieldsData [0]; MyColumn.Sortable := True; MyColumn.ReadOnly := True; MyColumn.ShowSummary := True; ------- --- this is it ------------------------ IF FieldsData.Count > 1 then begin if FieldsData [1] > '-1' then MyColumn.Width := StrToInt (FieldsData [1]) else MyColumn.Visible := False; end; I use file with settings for every grid and dinamically create it. If Lenght in file is biger of 0 then set up a column width from file else hide column. Quote Link to comment Share on other sites More sharing options...
MOGSY Posted September 20, 2020 Author Share Posted September 20, 2020 Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.