[fxruby-users] FXTable and Escape key

Lyle Johnson lyle at lylejohnson.name
Tue Mar 4 16:33:34 EST 2008

On Mar 4, 2008, at 2:17 PM, Tim Smith wrote:

> When editing an FXTable item, if you press Escape, your changes are  
> cancelled.  However, when an item is selected but not being edited,  
> the table still traps the Escape keypress.  As a result, in the  
> following code, if you open the dialog and then press Escape, it  
> closes.  But if you open the dialog, select an item in the table,  
> and then press Escape, nothing happens.  Is this behavior – trapping  
> Escape when no item is being edited – desirable?  I would expect the  
> dialog to close in both cases.

Jeroen will need to make the decision about whether this is the  
appropriate default behavior for FXTable (i.e. it's a FOX thing, not  
an FXRuby thing).

If you had some way to know for sure that the user is not currently  
editing a cell, you could just intercept the SEL_KEYPRESS message and  
handle it yourself, e.g.

	table.connect(SEL_KEYPRESS) do |sender, sel, event|
		if event.code == KEY_Escape && (we're not editing a cell)

The problem I'm running into is that the information that you need to  
make that determination (namely, whether or not an editor window has  
been constructed) isn't currently exposed to FXRuby. I will make a  
note to fix that in the next release.

Hope this helps,


"FXRuby: Create Lean and Mean GUIs with Ruby"
Now available as a Beta book from the Pragmatic Bookshelf

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20080304/04e42c07/attachment-0001.html 

More information about the fxruby-users mailing list