Jump to content


littlebigfred

Member Since 01 Feb 2008
Offline Last Active Apr 11 2010 11:40 PM
-----

Topics I've Started

Getting column type from dataset?

22 October 2009 - 01:54 AM

Hello

I have a couple of questions on how to go creating columns in a NextGrid from a dataset:

1. Is there a two-column list that maps NextGrid column types to compatible Delphi datatypes, eg. "TNxTextColumn = String", "TNxCheckBoxColumn = String, Boolean", "TNxNumberColumn = Integer, Double", etc.?

2. Is there a simple way to display the datatype returned by the dataset, and create a compatible column in a grid?

Here's the current code:
CODE
ASQLite3Query1.SQL.Text := 'SELECT * FROM mytable';
ASQLite3Query1.Open;

for mycol := 0 to ASQLite3Query1.FieldCount - 1 do begin
  //======== The quick way to see how wrapper maps SQLite to Delphi
  //E2250 There is no overloaded version of 'IntToStr' that can be called with these arguments
  //ShowMessage(IntToStr(ASQLite3Query1.Fields[mycol].DataType));

  //E2089 Invalid typecast
  //ShowMessage(String(ASQLite3Query1.Fields[mycol].DataType));

  //======== The longer way...
  case ASQLite3Query1.Fields[mycol].DataType of
    ftString:
      Columns.Add(TNxTextColumn,'My Col1');
    ftSmallint:
      Columns.Add(TNxNumberColumn,'My Col1');
    ftInteger:
      Columns.Add(TNxNumberColumn,'My Col1');
    ftWord:
      Columns.Add(TNxNumberColumn,'My Col1');
    etc.
  else
    ShowMessage('Other type');
  end;
end;


Thank you.

Hidding header to display rows as Slides?

14 October 2009 - 02:29 PM

Hello

I'm learning about the Slide layout. When the user has double-clicked a row, I'd like to switch from Report mode to Slide mode and hide the header so that the grid only displays a list of rows as Slides.

I didn't find how to hide a grid's header. Can it be done?

Thank you.

Using TNxCalcColumn and TNxGuidColumn?

13 October 2009 - 10:19 PM

Hello

I'm going through the articles in the DevNet section, and would like to know how to use the TNxCalcColumn column and the TNxGuidColumn column.

CODE
NextGrid1.Columns.Add(TNxCalcColumn,'My Calc');

//E2003 Undeclared identifier: 'TNxGuidColumn'
NextGrid1.Columns.Add(TNxGuidColumn,'My GUID');


Would someone have a small sample handy?

Thank you.

goIndicator? lsHorizontalOnly?

13 October 2009 - 04:09 PM

Hello

I have a couple of questions:
  1. What does the goIndicator option do?
  2. Why don't horizontal lines appear in the grid when I set its GridLinesStyle property?


CODE
With NextGrid1 do begin
  Columns.Add(TNxTextColumn,'My Col1');
  Columns.Last.Name := 'col1';

  Columns.Add(TNxTextColumn,'My Col2');
  Columns.Last.Name := 'col2';

  AddRow(1);
  CellsByName['col1',LastAddedRow] := 'test';
  AddRow(1);
  CellsByName['col1',LastAddedRow] := 'test2';

  //What is it?
  Options := Options - [goIndicator];

  //Lines not displayed
  GridLinesStyle := lsHorizontalOnly;
end;


Thank you.

Why need to add "NxColumns, NxColumnClasses"?

13 October 2009 - 03:59 PM

Hello

I was wondering why it's necessary to always add those two units to the Use section, while other NextGrid units are appended automatically when adding a TNextGrid control to a form?

Thank you.