[Solved] Problem with adding KeyActionListener in lemur TextField

Hi again

When adding a new KeyActionListener to a textField action map the new one removes textField’s default action for that specific key. I want to keep the default one along with the new one.
what do you suggest for solving this ?
Should i use textField.getActionMap().merge(); if yes can you provide an example please

If you want to call the original one also then you will need to retrieve it and have your new one delegate to it. (ie: chain them together)

I’m not looking at the code right now, but I’m 99.99% sure that key action maps are not lists of values. I think even Swing was this way.

I want to do this inside code :
1- Go to end of current line
2- Then create a new line

using this i could not achieve what i want.

textField.getDocumentModel().end(true);
textField.getDocumentModel().insertNewLine();

what is the proper way of doing this ?

Using lemur with true type font.
@Tryder may be relevant to you

Edit : I am calling them right after each-other. May be related to update method or so ?

The text should be getting updated, however the mesh is not being updated with the changes so you can’t see them. Try:

textField.getDocumentModel().end(true);
textField.getDocumentModel().insertNewLine();
textField.resetText();

You’ll need to download LemurDynamo-Beta3 which I just uploaded to Google Drive at the same link because I changed the resetText method to public access for you, previously it had protected access.

P.S. I didn’t go over to see what possible caveats there might be to allowing public access to that method, it shouldn’t be a problem for TrueTypeFonts, but I didn’t take a look to see what it did for BitmapFonts.

1 Like

For some reason, I only just noticed this.

The real issue is that the TextEntryComponent is not watching the DocumentModel for changes. I’ll try to remember to add a bug to the Lemur issue tracker. (unless someone else does) Neck deep in release notifications at the moment.

FYI: Lemur master has the changes necessary for external changes to the DocumentModel to automatically update the text entry field. It will be included in the next release.

1 Like

Thanks,
I am watching Lemur on github.

Cool. Then you also saw the new text entry state I added to the demo for testing this feature. :slight_smile:

Yes, thanks for demos. I have not fetched this new test yet (because of busy week) but i am free tomorrow and will go through the new test demo for text entry. :slight_smile: