Board index » delphi » D2: DBGrid, Column-Select

D2: DBGrid, Column-Select

Hi!

I want the user at runtime to select the columns he want to see.

Is there an easy solution? Does anyone know a ready-to-use component?

Bye,
  Georg.

 

Re:D2: DBGrid, Column-Select


Quote
Georg Ledermann (g...@beavis.infox.com) wrote:

: Hi!

: I want the user at runtime to select the columns he want to see.

: Is there an easy solution? Does anyone know a ready-to-use component?

It's a fairly easy solution.  Make a form which has two lists, one of
visible columns (via WhateverTable.FieldByName('A_Field').Visible), and
the other of not .Visible fields.  Let the user double click to cause
fields to move from one to the other.  Update table fields accordingly.

In the forms OnCreate method I would use

  with MyTable do
    for nI := 0 to FieldCount - 1 {nI == Hungarian Notation :-}
      if Fields[nI].Visible then
        PutIntoVisibleList( Fields[nI].FieldName )
      else
        PutIntoAvailableList( Fields[nI].FieldName );

And go from there.

When you figure out how to change the order of the fields in the DBGrid, let
me know! ;)

: Bye,
:   Georg.

Later
-Glen

Other Threads