-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextField #27
Comments
… will work and one that needs to be resolved before I can call it good.
The error preventing this from working says a widget already accepts an attribute named "role". I foresaw this when working on templates (#32, here) a while back, but didn't address it at the time. The problem is that I'm using a border, another templated widget, with specified content inside the template for text field. So to specify the content of the border from outside the template, there has to be a role for the text field template, and a role for the border. Right now the attribute manager only allows one attribute of a given name. The correct way to resolve this is to allow multiple attributes with the same name, and define well which one gets assigned if an attribute is specified by name (as opposed to by the attribute object itself). I suspect the attribute last accepted should be the one specifiable by name, but I need to make sure. The other problem is that in order to specify styles for the internals of the text field (corner radius of the border should be zero, the background color of the label should be white), I have to resort to using groups. As I wrote in #38, I think I should be able to specify styles for the attach points inside a template. |
an element (though only the most recent attribute added will be specifiable by name, i.e. through XML). The errors in the text field test went away, but now the screen is just blank (green).
… to the body in the template XML. This attribute is not modifiable or exposed through the templated element.
Text field now shows up. I had it showing the border with white inside (margin spacing between the border and the white). But after I moved the white style to the border pane, the border doesn't show up anymore. The border texture code is being called, so I don't know why it's not working. |
the border. It helps by rendering immediately instead of to a buffer. That way you can immediately see the effects of each graphics call.
Text field now renders correctly. At least 4 more things to do:
|
…, and a simple full implementation. Converted MuisTextElement to use a document model instead of rendering itself. Text no longer works in MUIS, so gotta debug.
The next thing to do is design the input mechanism. Think about allowing some of this to be specified in an attribute so that the feel of the widget can be switched out. |
Added listeners for content and selection changes
Not leaving it in a great state here. :-( There's still parsing errors with the style sheets even though I thought I'd fixed them. Gotta fix them before anything else has a chance to work. That said I did some good work today, even though text selection still isn't working. To do now:
|
…es some. Got the length attribute working for a bit, but the cursor location wasn't changing when text was appended. The refactor should help with this when it's done.
changes. TextField looks even better, but when you try to type too much text into the text field, it generates a String index out of range exception on the repaint event.
Good day! The design work and implementation for basic text fields is almost done, barring conceptual problems that show up later. There's an exception for one of the last features, filling a text box with more text than it can display. There's only one more feature I can think of that the basic (1-line) text box needs, and that's Home and End key support (with and without shift held). |
Text field looks better and better. There are a few issues, and then some features to add:
The features:
|
Hooking up to models (text fields and labels) is next. |
…mented it out. Stuff to think about.
I need to be able to change the document in a text element so a MUIS model may specify an actual document for a text widget. This would allow the model to insert a model that does different kinds of formatting. Possibly the use case for this is not likely and can be done other ways. Replacing the document is not trivial though. Listeners may have already been added to the document which would need to be transferred to the new document, but documents coming in from models may have listeners on them that MUIS did not add. It's sticky. |
Lots of build breaks, but I did reach a pretty good stopping point.
I need to test the latest code before I really call it good, but TextField is pretty good now. I'm gonna work on a nice demo of the existing functionality for a while before I add more features. |
other side: changes to the text field will modify the value now.
Just realized I need to fix TextField to not apply user changes to the model until focus lost or enter is pressed. Perhaps this could be an option. |
Been thinking more about this. I think rich editing will be done by a more complicated widget than this. Probably one with lots of buttons and other widgets to facilitate creating more complex documents. I'm not sure if formatting and validating should be done in this class or not (most likely not), but regardless that will be a separate task. So the things that need to be done before this can be closed are:
|
document in text field. Now user edits must be committed with enter or loss of focus before the model changes.
…ick and the line on triple-click. Also refactored user events to contain the mouse buttons and key codes that were pressed when the event was generated.
…xt content. Also fixed a bug with double-click text selection.
… the text field test pretty bad, may end up having to back this one out.
Multi-line support is in and text field looks pretty good. I mentioned in the comment just above that I wanted to batch events from AbstractSelectableDocumentModel. I tried this last night and it seemed like it messed some things up. My solution seemed simple and I don't understand why it didn't work. It's very possible that this can be done and it's also possible there's some conceptual problem with it. In any case, it doesn't affect text field's functionality to not be there. I'm sure to find bugs in it in the future, but I declare that the development of text field is done!!! |
Have the option of multiple lines instead of a separate TextArea widget (?)
Also create a ValidatedTextField widget. This widget should have modes for unset, incomplete, invalid, validation pending, and valid. Should have a simple mechanism for specifying styles for these different modes. Default would be a red fuzzy border for unset, incomplete, and invalid (possibly slightly different between them), an animated progress-like border for pending, and fading green fuzzy border for valid, finishing with an inconspicuous visual cue that the input is validated.
The text was updated successfully, but these errors were encountered: