Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread More Documentation for Unbound Grids.
Fri, Jul 10 2015 2:51 AMPermanent Link

Steve Gill

Avatar

Hi Tim,

IMHO, the EWB2 documentation is very good, however, I feel it is a little lacking in how to use TGrid in unbound mode.  For example: adding rows; deleting rows; clearing the grid; adding values to, and reading values from, cells.

That's pretty important information from my perspective. I realise it's early days for EWB2 and not everything is in the doco yet.

While on the subject of the TGrid, is there any word on when there might be a column that can support images?

I couldn't see anything in the EWB2 Roadmap.  I use grids a lot in my applications, and I use images as status indicators, etc.

Thanks.

= Steve
Fri, Jul 10 2015 3:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< While on the subject of the TGrid, is there any word on when there might
be a column that can support images?  >>

I'm trying to squeeze it into the 2.01 release, but it depends upon how fast
I can finish up the rest of the un-bound grid features, which are taking
precedence right now.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jul 10 2015 7:09 PMPermanent Link

Steve Gill

Avatar

<< I'm trying to squeeze it into the 2.01 release, but it depends upon how fast
I can finish up the rest of the un-bound grid features, which are taking
precedence right now. >>

Thanks Tim/Demo User. Smile I'd be happy with just a quick list of the methods in a forum post in the interim.

= Steve
Tue, Jul 14 2015 5:43 PMPermanent Link

Trinione

<< I'd be happy with just a quick list of the methods in a forum post in the interim.>>

Same here.

I have spent the past 2 hours trying to figure out stuff that really should be a quick click away for the info. Frown

Still no closer to knowing how to add data to the Cells.
Tue, Jul 14 2015 5:55 PMPermanent Link

Steve Gill

Avatar

<<  Same here.

I have spent the past 2 hours trying to figure out stuff that really should be a quick click away for the info. Frown

Still no closer to knowing how to add data to the Cells.>>

This is how I am adding data in a loop:

    grdUsers.AppendRow;
    grdUsers.Rows[i][FIRSTNAME_COLUMN] := Firstname;
    grdUsers.Rows[i][LASTNAME_COLUMN] := Lastname;
    grdUsers.Rows[i][EMAIL_COLUMN] := Email;
    grdUsers.Rows[i][ACTIVE_COLUMN] := Active;
    grdUsers.Rows[i][LAST_LOGIN_COLUMN] := LastLogin;
    grdUsers.Rows[i][USER_ID_COLUMN] := UserID;
    grdUsers.Rows[i][PASSWORD_COLUMN] := Password;

And this is how I am reading the values of a selected row:

    UserID := grdUsers.Rows[grdUsers.RowIndex][USER_ID_COLUMN];
    Firstname := grdUsers.Rows[grdUsers.RowIndex][FIRSTNAME_COLUMN];
    Lastname := grdUsers.Rows[grdUsers.RowIndex][LASTNAME_COLUMN];
    Email := grdUsers.Rows[grdUsers.RowIndex][EMAIL_COLUMN];
    Password := grdUsers.Rows[grdUsers.RowIndex][PASSWORD_COLUMN];
    Active := grdUsers.Rows[grdUsers.RowIndex][ACTIVE_COLUMN];
    LastLogin := grdUsers.Rows[grdUsers.RowIndex][LAST_LOGIN_COLUMN];

BTW, I always use constants for column indexes so I don't have to remember the column numbers, and they can easily be changed in one place if I decide to reorder the columns:

const
  FIRSTNAME_COLUMN                    = 0;
  LASTNAME_COLUMN                     = 1;
  EMAIL_COLUMN                        = 2;
  ACTIVE_COLUMN                       = 3;
  LAST_LOGIN_COLUMN                   = 4;
  USER_ID_COLUMN                      = 5;
  PASSWORD_COLUMN                     = 6;

So the format is: grdUsers.[RowNo][ColumnNo]

= Steve
Tue, Jul 14 2015 7:40 PMPermanent Link

Trinione

Steve,
Thank you! Absolutely timely assistance!

I just replaced the grid with a ListBox and looking for a workaround.

<< So the format is: grdUsers.[RowNo][ColumnNo] >>

That simply bit of information goes a long way!

Yes. Constants are indeed is much easier and I shall use accordingly.

Thanks again.
Sat, Jul 18 2015 12:19 AMPermanent Link

Trinione

<< So the format is: grdUsers.[RowNo][ColumnNo] >>

Sorry, that should be grdUsers.Rows[RowNo][ColumnNo]
Sat, Jul 18 2015 7:06 PMPermanent Link

Steve Gill

Avatar

<< Sorry, that should be grdUsers.Rows[RowNo][ColumnNo] >>

Oops, yes you're right. Sorry that was a typo.

= Steve
Mon, Jul 27 2015 3:14 PMPermanent Link

Malcolm Taylor

Thanks for the info in this thread, it made all the difference to my
sanity.
I even managed to select a cell with:
  AGrid.RowIndex := ARow;
  AGrid.ColumnIndex := AColumn;
Not sure if that is the correct way, but it does for now.  Surprised

Malcolm
Mon, Jul 27 2015 4:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Malcolm,

<< Thanks for the info in this thread, it made all the difference to my sanity.
I even managed to select a cell with:
  AGrid.RowIndex := ARow;
  AGrid.ColumnIndex := AColumn;

Not sure if that is the correct way, but it does for now. >>

Yes, that is the correct way of doing it.

There is documentation on all of this in the component reference that explains what the methods and properties do:

http://www.elevatesoft.com/manual?action=viewcomp&id=ewb2&comp=TGridControl

(one or more of those properties/methods are from 2.01, and may not be documented yet)

Tim Young
Elevate Software
www.elevatesoft.com
Image