Mark Volkmann
2006-Mar-28 00:43 UTC
[fxruby-users] detecting row and column selections in an FXTable
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. -- R. Mark Volkmann Object Computing, Inc.
Lyle Johnson
2006-Mar-28 01:36 UTC
[fxruby-users] detecting row and column selections in an FXTable
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 Hope this helps, Lyle
Mark Volkmann
2006-Mar-28 02:03 UTC
[fxruby-users] detecting row and column selections in an FXTable
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}" > endWhen 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? -- R. Mark Volkmann Object Computing, Inc.
Lyle Johnson
2006-Mar-28 03:21 UTC
[fxruby-users] detecting row and column selections in an FXTable
On Mar 27, 2006, at 8:03 PM, Mark Volkmann wrote:> 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?FOX calls the selectColumn() method when you click on a column header, so I think you might be able to pull this off if you subclass FXTable and override its selectColumn() method, e.g. class MyTable < FXTable def selectColumn(col, notify=false) puts "selected column #{col}" super end end Hope this helps, Lyle
Mark Volkmann
2006-Mar-28 19:47 UTC
[fxruby-users] detecting row and column selections in an FXTable
On 3/27/06, Lyle Johnson <lyle at knology.net> wrote:> > On Mar 27, 2006, at 8:03 PM, Mark Volkmann wrote: > > > 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? > > FOX calls the selectColumn() method when you click on a column header, > so I think you might be able to pull this off if you subclass FXTable > and override its selectColumn() method, e.g. > > class MyTable < FXTable > def selectColumn(col, notify=false) > puts "selected column #{col}" > super > end > endAre you sure about this? I''ve overridden that method and it doesn''t get called when I click a column header. I wonder if that method is only used to programatically select a column. Hopefully there is another way to be notified that the user clicked a column heading. -- R. Mark Volkmann Object Computing, Inc.
Lyle Johnson
2006-Mar-28 19:56 UTC
[fxruby-users] detecting row and column selections in an FXTable
On Mar 28, 2006, at 1:47 PM, Mark Volkmann wrote:> Are you sure about this? I''ve overridden that method and it doesn''t > get called when I click a column header...Looking at the code again, I think I see a bug (in FOX). Let me check this with Jeroen and see if there''s been a fix.
Lyle Johnson
2006-Mar-28 20:07 UTC
[fxruby-users] detecting row and column selections in an FXTable
On Mar 28, 2006, at 1:47 PM, Mark Volkmann wrote:> Are you sure about this? I''ve overridden that method and it doesn''t > get called when I click a column header. I wonder if that method is > only used to programatically select a column. Hopefully there is > another way to be notified that the user clicked a column heading.Mark, I was mistaken in my previous e-mail. It doesn''t look like that method (selectColumn) or the message handler associated with it (onCmdSelectColumn) ever gets used. I suspect it''s dead code, and I''ve posted a question about it on the foxgui-users list. So back to your original question, it doesn''t look like there''s an easy way to catch this event. When the user clicks on a column header, the table receives an ID_SELECT_COLUMN_INDEX message which is handled by its onCmdSelectColumnIndex() method. This is not a virtual method (in C++) that we can override. I''ll think about a possible workaround but nothing obvious comes to mind, unfortunately. Lyle
Meinrad Recheis
2006-Mar-28 22:57 UTC
[fxruby-users] detecting row and column selections in an FXTable
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
Mark Volkmann
2006-Mar-29 15:28 UTC
[fxruby-users] detecting row and column selections in an FXTable
On 3/28/06, Meinrad Recheis <meinrad.recheis at gmail.com> wrote:> 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| > > #... > > }Woo hoo! This is exactly what I needed. Thanks! -- R. Mark Volkmann Object Computing, Inc.