Bug - Fixed Buttons in Item Manager get wrong focus

xKiv

Active member
Every time I click on one of the right-hand-side buttons in Item Manager ("use item", "auto sell", ... "clan stash"), the button *below* the one I clicked gets focus (light blue rectangle). It's kind of disturbing.
I mean .. am I putting my items into closet/bag as I remember clicking, or am I actually putting them into DC as the GUI is suggesting? That's an important distinction in HC/ronin!
And also for people who have a lot of things in their DCs...
 

heeheehee

Developer
Staff member
"I thought I clicked consume, but the 'feed to ghost' got focused. Wait, what? I don't even have a ghost!"

Happens to me too.
 

lostcalpolydude

Developer
Staff member
This is easily reproducible and happens 100% of the time in every GUI section, as far as I can tell. Click on any button to have mafia do something, and the focus will shift to the next button when the operation finishes. What I usually notice is trying to search the mall for several things in a row, and having to Shift+Tab back to the Item to Find field to type in the name each time.

I wouldn't call it a bug necessarily (or in need of changing regardless of what it is), but I also don't think Cannot Reproduce fits. Doesn't really matter though.
 

Veracity

Developer
Staff member
This is easily reproducible and happens 100% of the time in every GUI section, as far as I can tell. Click on any button to have mafia do something, and the focus will shift to the next button when the operation finishes.
I remember been bothered by this a couple of years ago and looking into it a bit. I concluded that it's just the way Java Swing works; clicking a button will move focus to the next input field. I gave up investigating, at that time. However, I've been spending a lot of time trying to improve the GUI experience, including input focus, and it's probably time to investigate again, with a couple more years of experience behind me.

What I usually notice is trying to search the mall for several things in a row, and having to Shift+Tab back to the Item to Find field to type in the name each time.
I fixed this in revision 10273 ("When you click the Search button on the Purchase Frame, KoLmafia does a mall search. Leave focus on the "Item to Find" field when the search completes.") and 10274 ("When we switch to the Purchases Frame, give focus to the search field"). It took special code to get that behavior.

If there doesn't turn out to be a general Swing setting to force buttons to retain focus after they are pressed, I am sure that I can make the Action routines of individual buttons do that. Perhaps I can even make a button widget which does that automatically.
 

Veracity

Developer
Staff member
Well, that was easy. Revision 10391 adds an option to the ThreadedListener to allow the object it is attached to to retain focus after the execute() method does its thing. I enabled that for the buttons on the Item Manager.

I initially made it work that way for all Threaded Listeners, but then I discovered that that overrode my desired behavior on the Purchases Frame of keeping focus on the Item to Find text field when you pressed the Search button.
 
Top