Trapping tab in a VA container details part

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Trapping tab in a VA container details part

Steven LaFavor
I've got a Container Details part on a view with three columns that are editable.  I've hooked EwTextEditPolicy instances to each column to limit the number of characters that can be entered in each column, and I've set editable to true so that the fields can be edited directly in the table.

The tab key navigates thru the table correctly, but now I want to add another instance to the table when I hit tab on the last most (bottom right) cell.

I have followed the logic thru the processing a tab press, but I am definitely missing something on where to make this hook.

This seems like a pretty common thing to do and someone has definitely done something like this -- is it easier to hook an even into the "applicationDefinedTabbingRequested" handlers?   Subclass the AbtContainerDetailsView?

Looking for an idea how to continue forward on this.....

*Steve*

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Trapping tab in a VA container details part

Steven LaFavor
I've actually figured out a way to do this, and am posting it here so that maybe someone can use it/comment on it/ etc....

I've put the methods into subclasses, and while that is not completely necessary, it give me a way to separate the logic for future expansion and concerns.

(1) Add a subclass of EwTableList (mine is called StlfTableList)

(2) Put the following method in that class to override the inherited version:

StlfTableList>>cursorTabRight

self cursorNextCellRightWrapping ifFalse: [
self associatedPart processEndOfTableReached.
self refresh.
self cursorNextCellRightWrapping ifFalse: [^self]].
self
selectionEventOnlyOnCell: self cursoredCell
commit: true

(3) Add a subclass of AbtContainerDetailsView (mine is StlfContainerDetailsView).

(4) Add the following methods:

StlfContainerDetailsView class>>cwWidgetClass

^StlfTableList

StlfContainerDetailsView>>cellTabbingPolicy

^XmACROSSROWS

StlfContainerDetailsView>>processEndOfTableReached

self signalEvent: #endOfTableReached

Now you can drop a StlfContainerDetailsView on the canvas and add whatever logic you need to populate it.   Hook an event to script from the endOfTableReached event to whatever you want to do when you try to tab out of the bottom right cell.  In my case, when the user is in an "add" phase, I add a blank instance to the table, and it automatically tabs to the first cell of the new row.

Hope this helps someone.  If anyone know of a simpler way, please let us all know about it.

*Steve*

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.