Here I'm back with a small question ;-)

Here I'm back with a small question ;-)

I have a object that holds some GridData. 
 
 TabpGridAligment = ( left , center , right ) ;
 TabpFieldDataType = ( string , integer , boolean ,.....);
   
 GridData.Selectable : boolean ;
 GridData.RowAmount : integer ;
 GridData.ColumnData[0].FieldNameLogical : string ;
 GridData.ColumnData[0].FieldNameDisplay : string ;
 GridData.ColumnData[0].Alignment : TabpGridAlignment ;
 GridData.ColumnData[0].Width : integer ;
 GridData.FieldData[0].ID     : string ;       
 GridData.FieldData[0].Name   : string ;       
 GridData.FieldData[0].ValueLogical : string ;
 GridData.FieldData[0].ValueDisplay : string ;
 GridData.FieldData[0].DataType : TabpFieldDataType ;
 GridData.FieldData[0].IsChecked : boolean ;

Now I'm looking for a clean way to link the object to a READ-ONLY grid ( TadvStringGrid or TDBAdvGrid ) keeping in mind that the fetching of the data will not freeze the UI.

Currently my functionality uses an ugly TAB and CRLF separated string to fetch the next 20 rows until I'm at the end using the RowAmount field or AbortFetching is true.
Then I parses that string and update the cells of the StringGrid ( with a flickering grid as result ).
This entire fetching, parsing and update runs in a background thread and I think the synchronize is causing the flickering thing.

Now I want to rewrite this logic but I'm looking for a cleaner solution so I don't have that flickering. 
TDataSet or TClientDataSet looks like a good solution but it needs all that update , delete stuff what I don't need at all and it looks all that complicated.

Any other suggestions

Comments

  1. Udo Treichel Yes using the beginupdate and endupdate stuff

    ReplyDelete
  2. If you haven't already, you should check out www.stackoverflow.com. It's tailer made for Q&A. Most people here already have an account. When I have a question I'll post it there and post a link to it here. That way more people see it.

    ReplyDelete
  3. You may try to use TXDBData data set component from X-DBData Components package (http;//www.x-files.pl/components/xdbdata.html)

    To connect your GridData to any kind of TDBGrid component you should define FieldDefs and write 5 simple events:
    - OnCountRecords
    - OnGetFieldData
    - OnSetFieldData
    - OnDeleteRecord
    - OnInsertRecord

    Reading a source code of XDBDataUnit1 example would be helpful for you.

    ReplyDelete

Post a Comment