Using "Tab" key to move from NSTextField to NSMatrix - cocoa

I have a Cocoa Form (xib) which contains some NSTextFields and an NSMatrix of NSButtonCells. I can use the "Tab" key to tab though the NSTextFields, but the NSMatrix gets skipped over.
I want to be able to tab into the NSMatrix, and tab from one button to the next within the matrix.
I have put in the following line of code, but it is having no effect:
[mtxMyMatrix setTabKeyTraversesCells:YES];
Can anybody help with this problem or point me to an example? I have searched for hours with no success.

I had a similar problem and the solution I found was fiddling with the "first responder" setting. Specifically, making sure that the entire form didn't refuse, and each individual field likewise accepted first responder status. Again, the whole form, and each field as well. I too searched for a while... :( I'm also noob.

Related

Why changing the focus programatically on secured text box lets last character appear

Lets say I have a secured textfield and I am trying to change the focus to some other textfield on UIControlEventEditingChanged by calling BecomeFirstResponder or ResignFirstResponder then the last character is still visible
I am changing the focus to second text box when it reaches three characters but you can see third character is still visible even after the focus is on next textfield and one more character was also typed in.
if you non-programatically i.e manually change the focus from secured textfield to some other textfield then this problem is not happening.
Has anybody discovered any workaround to fix the issue ?
Please click here to go to a sample project which demonstrates this problem
P.S
I have already reported the issue in Apple Bug Reporter

Can/Should NSSheets be used for text field input?

I have a Cocoa app underway and I'm thinking about how to get people to enter and/or change text fields.
The main window is an NSTableView, and there are subordinate tables, where people will add/choose selections.
I was thinking that for both adding a new record, or selecting from a set, an NSSheet could work quite nicely. But I don't know if this is appropriate.
Finally, are there better ways to do this? Examples?
Ok, so as you wanted to add new record on the basis of user selection in the sheet. If really its requirement then it is fine, there is no any issue on using sheet.
But only problem is performance issue will be there. Because user has to first click on button and then sheet will appear and then enter into textfield and then again click on the ok button or cancel button so it seems like delaying in your application.

Filtering text in NSTableView

I have an NSTableView in which I need to be able to intercept keyboard events within an editable cell and replace the cell with strings. For example, press "a" and have the "a" intercepted and the value "Alpha" assigned when the table reloads. The actual situation is a bit more complex in that I'm also handling HID devices, but that's a whole other story. Suffice it to say, I just want to be able to go into edit mode and stop the keyboard-generated values from being displayed.
The latter part of this (displaying "Alpha") is easy, but I can't figure out the first part of the problem. If I subclass the table and make it first responder, I can receive the keyDown: event, but once the user double-clicks on a cell and starts typing, this goes silent.
Since none of the other NSTableView components (NSCell, NSTextFieldCell, etc) derive from NSResponder, I'm assuming there is an NSTextField buried in there somewhere.
So, what's the best way to filter text once the user goes into cell edit mode?
As always happens: after working on this for eight hours, reading all the docs five times, and then resorting to the net, I find the answer five minutes later:
- (BOOL)textShouldBeginEditing:(NSText *)textObject.
Sorry to consume bandwidth.

NSStepper ignores current NSTextField value

I have the same initial problem as described in Integrate NSStepper with NSTextField:
I need to have a NSTextField working with a NSStepper as being one control so that I can edit an integer value either by changing it directly on the text field or using the stepper up/down arrows.
Using bindings as commented on by carlosb results in a usable UI. However, in the initial question carlosb describes the following:
Problem is that if I edit the text field then click the stepper again it will forget about the value I manually edited and use the stepper's internal value.
This is why I am posting a variation on this question again. carlosb's use of bindings doesn't solve this problem. This happens in both the current project I am working on and a test project I have created. The test project can be found at GitHub. You can download it there (even without git) via the "Download Source" button in the top right.
Is there a clean way to solve this issue?
Text fields and sliders are both in the view layer of the MVC pattern. You'll have much better results by binding both of those views to a property of your controller.
Your problem is that that the editing isn't ended until you press return or the field loses focus (so the number is never actually changed). If you press return or leave the field after editing, you'll see it works as expected.
One solution is to check the "Continuously Updates Value" option in the text field's value binding and check the "Continuous" option in the text field's attributes.
This will make sure the value is being updated as it's typed, so an immediate click on the stepper will reflect these changes.

Janus GridEX Problem

It's a longshot that anyone can help with this, but here goes. I inherited a VB6 app with a Janus GridEX control. It iterates through records, and is editable. Problem is, if I edit a cell and hit the button to go to the next record, the change is applied to the next record, not the one I was editing. It's like, I need it to finish up the edit before going to the next record. I've had this sort of problem before in VC++, and sometimes you have to "KillFocus" on the control you're on or something. I just don't know what to do here. I tried sending a carriage return, since if you return out of the edit cell, it works, but sending a carriage return manually doesn't work. What's the secret?
Is your grid bound or unbound?
It's hard to tell from your description, but I imagine that if your are having this problem then it's probably bound.
As the other answer asked, is the button the RecordNavigator that is built into the control or is it a separate button? The reason I bring this up again, is that I have seen issues in the VB6 applications I support where a toolbar will often intercept and interfere with how the JanusGrid should work.
To get around this limitation, I have added the following code in the click handler of any toolbars where there is also a JanusGrid control on the form.
If jsgxYourGridName.EditMode = jgexEditModeOn Then jsgxYourGridName.Update
This way any changes are immediately applied to the current row.
If this does not help, then I have also seen problems where the recordset that is bound to the grid gets out of sync with the internal recordset in the grid. You can check this by comparing the bookmark of the grid to the bookmark of the recordset.
Ie. mrsYourRecordset.Bookmark = jsgxYourGrid.ADORecordset.Bookmark
At one point I may have also used something like this.
jsgxYourGrid.ADORecordset.Bookmark = jsgxYourGrid.RowBookmark(jsgxYourGrid.RowIndex(jsgxYourGrid.Row))
Finally you can try setting a breakpoint in the BeforeUpdate, RowColChange and/or AfterColUpdate events of the grid, to see what record the grid is really on when clicking on the button.
It depends whether the button is internal to Janus GridEX or not. If it internal then just about the only thing you can do is look at the events the control exposes to see if there a sequence that can let you know that this problem occurs. Then you can try to take corrective action by restoring the row you moved to and put the edit in the row you left.
If the button is external to Janus then you can use the debug mode to trace sequence of statement that control the transfer of focus to the next row. It could be something out of order or a side effect of the particular sequence of commands. I have run into both with different controls.
Remember that you can edit while in debug mode so you can try different approaches and test until you find one that works.

Resources