Update on Quest for Multi-Column Listbox in FXRuby

I hate to keep bugging the list, but I am so close!

I have created an FXIconList with four columns:

@table = FXIconList.new(frame, nil, 0,
ICONLIST_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
@table.appendHeader(“Plane”,nil,130)
@table.appendHeader(“Country”,nil,130)
@table.appendHeader(“Speed”,nil,130)
@table.appendHeader(“Range”,nil,130)

It works great. But when I go to add rows, I can only add stuff to the
first column. I have tried all of the following:

@table.appendItem(“Spitfire”,“Great Britain”,“333”,“454”)
@table.appendItem(“Spitfire”, nil, nil, “Great Britain”, “333”, “454”)
@table.appendItem([“Spitfire”,“Great Britain”,“333”,“454”])

But none of them work. The best I can do is:
@table.appendItem(“Spitfire”)

Which works, but (of, course) only fills up the first column.

The Fox docs show the arguments to appendItem being a string, a couple of
icons, and a pointer to userdata. I’m not sure how I am supposed to tell it
to put strings into individual columns.

Thanks for any help!
Jamey.

···

-----Original Message-----
From: CRIBBSJ
Sent: Monday, December 09, 2002 9:39 AM
To: ruby-talk@ruby-lang.org
Subject: Update on Quest for Multi-Column Listbox in FXRuby

Well, I played with FXTable this weekend, and I almost got it working the
way I want. I got it so that when I select a new row, either by clicking or
by using the arrow/Page-Up keys, it deselects the old row, selects the
entire new row, and updates the current cell. I thought I was done, until I
realized that the cells all seem to right-justify their contents. I could
not find any way to set the justification for a cell. Am I missing
something?

The other approach I am going to try tonight is to use an FXIconList
(recommended by Lyle). But the only example I can find is using a
FXFilelist, which is a descendant of FXIconList. The only problem is that
because it is hard-coded to be used listing a directory, it doesn’t show any
of the initialization arguments that would be used with FXIconList. Anyone
have an example of using FXIconList that they could share?

Thanks.

Jamey.

CRIBBSJ wrote:

I have created an FXIconList with four columns:

@table = FXIconList.new(frame, nil, 0,
ICONLIST_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y)
@table.appendHeader(“Plane”,nil,130)
@table.appendHeader(“Country”,nil,130)
@table.appendHeader(“Speed”,nil,130)
@table.appendHeader(“Range”,nil,130)

It works great. But when I go to add rows, I can only add stuff to the
first column. I have tried all of the following:

@table.appendItem(“Spitfire”,“Great Britain”,“333”,“454”)
@table.appendItem(“Spitfire”, nil, nil, “Great Britain”, “333”, “454”)
@table.appendItem([“Spitfire”,“Great Britain”,“333”,“454”])

But none of them work. The best I can do is:
@table.appendItem(“Spitfire”)

Which works, but (of, course) only fills up the first column.

The Fox docs show the arguments to appendItem being a string, a couple of
icons, and a pointer to userdata. I’m not sure how I am supposed to tell it
to put strings into individual columns.

Use tabs to delimit the fields:

 @table.appendItem("Spitfire\tGreat Britain\t333\t454")

HTH,

Lyle