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

Meinrad Recheis meinrad.recheis at gmail.com
Tue Mar 28 17:57:50 EST 2006


On 3/28/06, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> On 3/27/06, Lyle Johnson <lyle at knology.net> wrote:
> >
> > 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}"
> >         end
>
> When I click a column header, I get a separate event for every cell in
> that column.
> Is there a way to just get one event that says a column header (or a
> row header) was selected?
>

@table.columnHeader.connect(SEL_COMMAND){|a,b,index|

	#...

}

works well for me.
-- henon



More information about the fxruby-users mailing list