About Monkey 2 › Forums › Monkey 2 Development › Textfield doesn't lose focus when other gadgets are interacted with
This topic contains 7 replies, has 2 voices, and was last updated by
skn3 2 years, 6 months ago.
-
AuthorPosts
-
October 18, 2016 at 5:30 pm #4514
Looking at the code it looks like not all gadgets/views are currently calling MakeKeyView. So for example if I select a textfield, then select a list item, then the textfield cursor remains.
October 18, 2016 at 5:31 pm #4515P.S. where do you want bug reports, here or on Github issues?
October 18, 2016 at 6:20 pm #4517ListView does not currently respond to key events.
Mojox is still a WIP, so there will be many ‘holes’ like this in it. Things’ll happen over time, but if you’re after a 100% complete GUI system mojox probably isn’t for you!
October 18, 2016 at 8:08 pm #4520Sorry I have probably given the impression that I am complaining about monkey2. I was just trying to be helpful.
MojoX is working out great for me at the minute! Really quick to get some basic tool stuff running.

The bug report in this thread was causing a crash for me. I had a Lambda function that was responding to textfield changes, after clicking the listview and then typing, it was hard crashing the app. I fixed it by manually setting the KeyView in my app code.
October 18, 2016 at 9:15 pm #4526Sorry I have probably given the impression that I am complaining about monkey2.
No problem, just wanted to make extra sure you realized that mojox is currently a bit , erm, idiosyncratic.
But by the look of the screenshot, you seem to be doing just fine!
The bug report in this thread
Link missing?
October 18, 2016 at 9:52 pm #4530Nothing wrong with some idiosyncrasies
Bug report:
Well basically just that there doesn’t currently seem to be any Focus/Blur handling for views. Its implemented for items that receive text input, but not for others. So I am able to keep typing in a text field, even after I have clicked a button that should have blurred it.
As you have suggested this is probably more of a WIP issue then a bug. For now I can just manually add it into bits of my code, but it would be good if all views handled this and then reported OnFocus and OnBlur event callbacks.
October 18, 2016 at 10:05 pm #4531Bug report:
Ahh, OK, though it was another bug as you didn’t mention a crash originally.
Any way for me to easily reproduce the crash?
October 18, 2016 at 10:33 pm #4533Ok I have created something that will reproduce. Now that I have isolated it, it turns out that it is actually a bug (and not my own user error) .
Steps:
- press “item2” button
- select the text field and position the cursor at the end of the text
- press “item1” button
- start typing on the keyboard
- CRASH
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162#import "<std>"#import "<mojo>"#import "<mojox>"Using std..Using mojo..Using mojox..Class MyWindow Extends WindowField currentItem:ItemClass ItemField name:StringMethod New(name:String)Self.name = nameEndEndMethod New()Super.New("Bug",640,480,WindowFlags.Resizable)'create itemsLocal item1 := New Item("apple")Local item2 := New Item("long_item_name")'create text fieldLocal textField := New TextField()'create buttonsLocal button1:=New Button("item1")button1.Clicked=Lambda()currentItem = item1textField.Text = currentItem.nameEndLocal button2:=New Button("item2")button2.Clicked=Lambda()currentItem = item2textField.Text = currentItem.nameEnd'setup layoutLocal dockingView:=New DockingViewdockingView.AddView(button1,"left")dockingView.AddView(button2,"left")dockingView.ContentView=textFieldContentView=dockingViewEndEndFunction Main()New AppInstanceNew MyWindowApp.Run()End -
AuthorPosts
You must be logged in to reply to this topic.