[fxruby-users] detecting row and column selections in an FXTable

Lyle Johnson lyle at knology.net
Mon Mar 27 20:36:59 EST 2006

On Mar 27, 2006, at 6:43 PM, Mark Volkmann wrote:

> What's the proper way to detect when a row header or column header in
> an FXTable is clicked. I tried this, but it didn't work.
> table.connect(SEL_SELECTED) do |table, selection, position|
>   type = FXSELTYPE(selection)
>   identifier = FXSELID(selection)
>   puts "column selected" if identier == FXTable::ID_SELECT_COLUMN
> end
> It seems that identifier always gets set to zero.

A bug was fixed for this in FXRuby 1.4.4 (see the change notes at 
http://www.fxruby.org/doc/changes.html). The table widget is supposed 
to send an FXTablePos instance along as its message data, from which 
you could extract the selected row and column:

	table.connect(SEL_SELECTED) do |table, sel, table_pos|
		puts "selected row, col = #{table_pos.row}, #{table_pos.col}"

Hope this helps,


More information about the fxruby-users mailing list