Added 'nil' display value to optionally nullable values in the table view #175
Conversation
|
||
NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:self.bounds pullsDown:NO]; | ||
popupButton.translatesAutoresizingMaskIntoConstraints = NO; | ||
[popupButton addItemsWithTitles:@[@"nil", @"False", @"True"]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using lower case for True
and False
should be more convenient
I have some suggestions here :)
|
I'm not opposed to using red, but if we're looking for alternatives, maybe just light gray to appear dimmed out is better? |
Fair enough! Thanks for the feedback guys! I tried changing That being said, when you set the colour via In response to the other queries:
I was considering just extending the
At the moment, if the string supports nullability, and you delete everything in there, it'll defer back to nil. If the string was explicitly marked as non-optional, then the Browser will automatically fill it with an empty string (i.e. |
Light grey looks good! As for highlighting the only thing that comes to mind is to override As for |
The browser should definitely support differentiating between nil and the empty string (both visually and when editing). I would suggest that deleting the string makes it an empty string, and then offering the option to set it to |
@stel: Awesome! Thanks for the tip. I was able to get all of the elements coloured properly when selected now: (Apparently it's not possible to change the colour of the 'handle' next to the optional
I don't know about that. When a I still think it makes sense to keep these two cell types separate due to the way they both behave differently. Maybe @jpsim can chime in with his opinion on this. :) @astigsen Okay! Fair enough. There could easily be use cases where an app could be using I've added an extra menu item named "Insert empty string value" that appears when you right-click on an optional string column. I'm still working out how to display this difference visually in the Browser (It turns out |
Treating the empty string as nil if the property is nullable seems incredibly confusing. We'd clearly still be treating it as an empty string if the property is not nullable. That means you have to do different things to get the same value for the property depending on whether it's nullable or not. |
Hopefully it just boils down to the point that we represent the property in the UI properly. If you completely clear a string property that was marked nullable, then it'll display If the string property was not marked optional, then by default, when clearing the text field, it should be deferred to an empty, non-null string. In the case that the user wants to make a nullable string filled, but not hold a value, we can use an empty string value. I'm going to see if I can make the text field display Again, I don't think there'll be too many use cases where there'll be a nullable string field, but the user will want to insert a non-nil, yet empty string. But if everyone would prefer I do it that way, I'll defer to your judgment. :) |
Actually, I've played with it for a while now, and it turns out that trying to keep a proper separation between I'll look at it again next week, but I might need to rethink how this is being handled and displayed in the Browser. |
I like the idea with popup menu and From one hand it's not straightforward to set optional string to |
…nd changed case." This reverts commit 356cf4d.
…ontrol and changed case."" This reverts commit 6fdfab3.
…owser-osx into to-nullable-cells f11129a14b8139aaa1959f7a5.
Alrighty. I need to push this along since I've got some other issues to start. :) I discovered that glitchy enumeration bug was being cause by my code trying to change the placeholder text colour while it wasn't on the main thread. So I've fixed that, and it's all working perfectly now. Since it's holding up actually having nullability at all in the Browser right now, I actually think the As for the checkbox vs popup debate, I still think this is the best solution from a user experience solution. While we should definitely aim to compact the number of custom cells we have, I think in this case, it makes sense to have two. |
Up until now, the Browser didn't really properly represent item values that were 'truly' nil. String values were rendered as empty test fields, and numeric values were being displayed as '0'.
This PR introduces the ability for the Browser to properly differentiate nil values, with a red 'nil' string being displayed in property types that are both optional, and presently empty.
Let me know what you think of that visual style, and if you think there's something more appropriate we should use. :)
/cc @jpsim @stel