Can't take focus off NSTextField and select other NSTextFields - swift

I am having a bit of a problem with the UI/data entry part of my macOS application. In my application I have 6 NSTextFields, 1 NSDatePicker and 1 NSPopupButton. After typing in one NSTextField (specifically the one assigned to an outlet called "itemDescriptionField" in my code) It will not allow me to select other text fields or the date picker. The code can be found at:
https://github.com/Macintoshuser2/Inventory-Manager-macOS-Swift
How can I go about resolving this?

The description field has a number formatter. Type numbers or remove the number formatter.

Related

How to add another Text Field in VISIO?

As soon as we drag and drop any component we can see the component's name in a text field.. Similarly I want another Text Field with some numeric value like 1.0 , 2.0 to be generated and show it with the Component.
the issue is I am getting only 1 TEXT FIELD option.. Can you help me to understand this.enter image description here
You can have as many text fields as you want, you need to be in the shape text editor (hit F2 first so that text edit is opened, and then insert fields). Here is a video. Please note that this is not a programming question, probably should be closed here as offtopic.

Display what AVSpeechSynthesizer is showing as subtitles with Swift

I have an array with quotations, and am using a button to start a random quotation playing from the array.
I'm wondering, how would I have the selected random quotation also displayed in the ViewController so that people can read what the speechsynthesizer is reading?
How would I have the selected random quotation also displayed in the ViewController so that people can read what the speechsynthesizer is reading?
The best way to highlight the vocalized word is using the speechSynthesizer:willSpeakRangeOfSpeechString:utterance: method of the AVSpeechSynthesizerDelegate protocol.
Instead of copying and pasting the code snippet here, take a look at this complete and useful example (ObjC and Swift) that displays the vocalized word in a bold font with the speech synthesis.
...is there some way of using Subtitles.sizeToFit() so that the Label is split into 3 or more rows, instead of just "one row till infinity"?
In the Xcode Interface Builder - Attributes Inspector, set the value of the label property Lines to 0 and adapt your constraints to get a multiline presentation.
Add a label to your view and and set the quote text to it
quoteLabel.text = randomQuote
To show your label on multiple rows add:
label.numberOfLines = 0

Adding custom event "liveChange" to date picker

I have requirement that sap.m.DatePicker should prevent alphabets but accept numbers. And the maximum input length should be 10.
When two digits entered for date, e.g. "10", a dot (".") should be automatically added. Also month. At the end, it should look like "10.12.2019" in DatePicker. I guess it would be possible with liveChange event, but DatePicker doesn't have liveChange.
Please let me know how to add custom liveChange event in DatePicker. It would be great help.
Currently (as of SAPUI5 1.64), there is no event such as liveChange for DatePicker. To add this functionality, you can create your own control and let it extend DatePicker. Then add the control to your view, attach an event handler and update the DatePicker's value using DatePicker#setValue.
You can take a look at
how to create a custom control in SAPUI5 here.
the liveChange implementation of sap.m.Input here.
The maxLength property of the input will be set by SAPUI5 automatically if you specify the DatePicker's property displayFormat, in your case dd.MM.yyyy.
OpenUI5/SAPUI5 1.104 adds the liveChange event to the following controls:
sap.m.DateTimeField controls, e.g.:
sap.m.DatePicker
sap.m.DateTimePicker
sap.m.DateRangeSelection
sap.m.TimePicker
sap.m.MaskInput
See commit: 72fdbf4.

Collapsable Table Cells [Swift 3] [duplicate]

This question already has answers here:
Accordion table cell - How to dynamically expand/contract uitableviewcell?
(5 answers)
Closed 6 years ago.
I am trying to recreate the collapsable date picker that the calendar app uses when creating a new event. I've put an example of what I'm trying to do on github
In short, I've created a static table, added three cells. The first cell is for the date, and contains a button to toggle the second cell. The second cell is the date picker. The third cell is arbitrary. In the code I'm trying to set the height of the table cell (and the date picker if needed) to zero, and then toggle the size whenever the user clicks the button. No matter what I've tried, I can't a) get the cell to collapse without some sort of gap, and 2) get the animation to smoothly transition from expanded to collapsed and back again.
Edit: This question is not the same as the duplicate answer, in that I wanted to expand a separate table cell and not the same cell as being selected. But, I personally can live with using a same-cell expansion. I also updated my github project so future people can see a working example.
It's very simple; you are probably over-thinking things here. This functionality is built in; Apple wants you to be able to expand and contract a cell. You just aren't using the API Apple has provided. Use it! Here's how.
The date picker cells are always present. But their height is zero (and their clipsToBounds is true) so you don't see them. So implement heightForRowAtIndexPath to return zero for those cells.
To show a date picker cell, change what heightForRowAtIndexPath returns (this is easiest if you have a property that holds this value, so you can just change the property value and have heightForRowAtIndexPath read it from there) and say:
self.tableView.beginUpdates()
self.tableView.endUpdates()
That's all there is to it!
Here's a quick demo I made. The red and orange things are cells. The table has three cells but the second one, containing the date picker, starts out with zero height:

GXT 3 spinnerField validation

I want to validate that user cannot change spinner value manually by typing in text box of spinner.
For example a field sales multiple = x which I fetched from server not fix.
and displays a spinner field with limitation of like bellow
spinner.setMinValue = x
spinner.setIncrement = x
spinner.setValue = x
so user forcefully select a value which is multiple with x. e.g. if x=3 the user have to enter 3,6,9... and so on.
So here my issue is if I type a 2 in spinner field text box. GXT widget accept that value.
Posible solutions:
Is there any predefined properties of spinnerfield that i forget to set it?
Is there any predefined validator for this?
Can I set text box of spinner field read only by css so user cannot focus on text box but still change a value.
If none of above how to achieve manually?
i've searched a bit in the different classes and I don't see either a precise method which would set what you want.
Don't know about one, and even with one, a validator doesn't change the value in the input field, but maybe it's enough for your needs.
You can disable the text input by calling setEditable(boolean) on the spinnerfield (testSpinner.setEditable(false);)
Maybe you could search around the IntegerPropertyEditor, I haven't tried but as long as a new Spinner is like this:
SpinnerField<Integer> testSpinner = new SpinnerField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
you can seen that there is another Constructor for IntegerPropertyEditor, which takes a "NumberFormat" param, but there is no NumberFormart() constructor, so I'm not sure about how you create your own one, but that could be an idea (to format numbers in the input to be a multiple of the increment).
The last option would be that Sencha forgot this possibility and that you should report this as a "bug" on the forum ?
Hope to have helped a bit, good luck :).