myk's code contributions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: myk's code contributions
by Chris H. » 10 Feb 2013, 15:46
I would like to suggest that a shortcut should be listed in the appropriate tooltip as it is easy to forget the actual shortcut used and we do not want to complicate things by making people look through a lot of messages here to find an answer. 

-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: myk's code contributions
by myk » 10 Feb 2013, 18:42
That would be true if the list were sorted by name, but there is no guarantee that it is. Also, there are many cards that have only common words in their names. Imagine trying to get to 'goblin berserker' by typing only 'goblin' or 'berserker'. Another option is that I could intercept the spacebar while the search popup is shown -- it goes away in 5 seconds (or, it will once I get it implemented). Would that be an acceptable compromise?
Btw, I fixed it a while ago so that tab switches focus between widgets.
Btw, I fixed it a while ago so that tab switches focus between widgets.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Max mtg » 10 Feb 2013, 19:28
Well, that would be odd - finding a card in a table sorted in different way than by name.
Anyway, I like you idea of intercepting user input into a popup.
Speaking of the latter - what do you think of typing card name right into filter textbox instead of a popup when the table has focus? So that any letter typed while table is focused moves focus to filter textbox (and types that letter there). And while the filter box is focused, one may press up and down arrows to move focus into table to select the line one is looking for.
- This has its cons as well -
Will ruin the filter if player was using that filter to select cards by type.
Unapplicable to player's deck which has no filter textbox (and due to being smal enough does not need one).
Anyway, I like you idea of intercepting user input into a popup.
Speaking of the latter - what do you think of typing card name right into filter textbox instead of a popup when the table has focus? So that any letter typed while table is focused moves focus to filter textbox (and types that letter there). And while the filter box is focused, one may press up and down arrows to move focus into table to select the line one is looking for.
- This has its cons as well -
Will ruin the filter if player was using that filter to select cards by type.
Unapplicable to player's deck which has no filter textbox (and due to being smal enough does not need one).
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by friarsol » 11 Feb 2013, 01:23
I noticed when deselecting the packs filter that all the other numbers also decrease.
Ex: 14 White, 13 Blue, when I deselect the 8 Packs White now displays 6 and Blue now displays 5. I just did a quick count and these 6 and 5 numbers are correct, so it looks like it's counting Packs as all 5 colors?
Ex: 14 White, 13 Blue, when I deselect the 8 Packs White now displays 6 and Blue now displays 5. I just did a quick count and these 6 and 5 numbers are correct, so it looks like it's counting Packs as all 5 colors?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: myk's code contributions
by myk » 11 Feb 2013, 02:22
This is actually my modus operandi. While building decks, I usually have the tables sorted first by CMC, then by type, and finally by name. In the spell shop, I usually have it sorted first by owned quantity.Max mtg wrote:Well, that would be odd - finding a card in a table sorted in different way than by name.
I just got a version of this checked in. Try it out and see if you like it. Left/right arrow keys also switch focus between the tables, so management with the keyboard should be a lot easier now.Anyway, I like you idea of intercepting user input into a popup.
I think that might be a little confusing to have different visual feedback for the two tables for the same functionality. I'd also be unwilling to lose the accessibility of the string filter functionality (unless, of course, it becomes apparent that users are not using it).Speaking of the latter - what do you think of typing card name right into filter textbox instead of a popup when the table has focus? So that any letter typed while table is focused moves focus to filter textbox (and types that letter there). And while the filter box is focused, one may press up and down arrows to move focus into table to select the line one is looking for.
- This has its cons as well -
Will ruin the filter if player was using that filter to select cards by type.
Unapplicable to player's deck which has no filter textbox (and due to being smal enough does not need one).
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Max mtg » 11 Feb 2013, 10:15
Does not work right out-of-the-box.myk wrote:I just got a version of this checked in. Try it out and see if you like it. Left/right arrow keys also switch focus between the tables, so management with the keyboard should be a lot easier now.
- Code: Select all
java.lang.NullPointerException
at forge.gui.deckeditor.CDeckEditorUI$_FindAsYouType._findNextMatch(CDeckEditorUI.java:320)
at forge.gui.deckeditor.CDeckEditorUI$_FindAsYouType.keyTyped(CDeckEditorUI.java:392)
at java.awt.AWTEventMulticaster.keyTyped(Unknown Source)
Left/right arrows work properly, thanks!
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 11 Feb 2013, 16:09
What OS are you on? Is it possible that SwingUtilities.getWindowAncestor(popupLabel) is returning null?
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Max mtg » 11 Feb 2013, 17:16
windows 7 x64myk wrote:What OS are you on? Is it possible that SwingUtilities.getWindowAncestor(popupLabel) is returning null?
That expression does return null - i've checked.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 11 Feb 2013, 17:54
Hrmph. I don't have a windows machine to test on, but I checked in a potential fix. Could you try it again and see if it works for you now?
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by RumbleBBU » 12 Feb 2013, 08:11
Myk, congrats on the new DialogChooseSets class - a light-years improvement over the previous one!
However, there was a slight problem. The Alpha and Beta sets were deliberately disabled in the old version: including them in the Quest format would seriously unbalance the game, since you could sell practically any Alpha or Beta card you win in a booster would for a silly price and make obscene amounts of credits very quickly. Unlimited covers practically the same cardbase but at a slightly saner price.
I took the liberty of re-disabling Alpha and Beta in the dialog. I hope that's not too much of an inconvenience. Please feel free to modify the relevant code as you see fit.
However, there was a slight problem. The Alpha and Beta sets were deliberately disabled in the old version: including them in the Quest format would seriously unbalance the game, since you could sell practically any Alpha or Beta card you win in a booster would for a silly price and make obscene amounts of credits very quickly. Unlimited covers practically the same cardbase but at a slightly saner price.
I took the liberty of re-disabling Alpha and Beta in the dialog. I hope that's not too much of an inconvenience. Please feel free to modify the relevant code as you see fit.
Re: myk's code contributions
by Max mtg » 12 Feb 2013, 10:16
Oh, that test:
- still crashes =(
that SwingUtils.getRoot method is trying to obtain the topmost parent in hierarchy up from the component you give it as a parameter. It requires a Window or Applet instance to return.
So I tracked the parents in debugger and found that the last parent is
javax.swing.PopupFactory$MediumWeightPopup$MediumWeightComponent[panel0,1942,211,235x17,invalid,layout=java.awt.BorderLayout]
and it's parent is null.
- still crashes =(
that SwingUtils.getRoot method is trying to obtain the topmost parent in hierarchy up from the component you give it as a parameter. It requires a Window or Applet instance to return.
So I tracked the parents in debugger and found that the last parent is
javax.swing.PopupFactory$MediumWeightPopup$MediumWeightComponent[panel0,1942,211,235x17,invalid,layout=java.awt.BorderLayout]
and it's parent is null.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 12 Feb 2013, 16:13
Thanks for the positive feedback : ) I'm sorry I didn't see that problem sooner -- I had /intended/ to keep them disabled, but a bug in FCheckBoxList was unconditionally re-enabling everything. That bug is be fixed now, and the disabling of sets listed in unselectableSets now works again. I removed the hard-coded disabling of LEA and LEB since that dialog is also used for the set filter, where those sets should be choosable.RumbleBBU wrote:Myk, congrats on the new DialogChooseSets class - a light-years improvement over the previous one!
However, there was a slight problem. The Alpha and Beta sets were deliberately disabled in the old version: including them in the Quest format would seriously unbalance the game, since you could sell practically any Alpha or Beta card you win in a booster would for a silly price and make obscene amounts of credits very quickly. Unlimited covers practically the same cardbase but at a slightly saner price.
I took the liberty of re-disabling Alpha and Beta in the dialog. I hope that's not too much of an inconvenience. Please feel free to modify the relevant code as you see fit.
Thanks for testing and debugging. I'll play with it a little more -- maybe a simple getParent() is all I need, and if I can't get that to work, I can hide the popup and reallocate a new one on every character. Not ideal, but superior to a crash.Max mtg wrote:Oh, that test:
- still crashes =(
that SwingUtils.getRoot method is trying to obtain the topmost parent in hierarchy up from the component you give it as a parameter. It requires a Window or Applet instance to return.
So I tracked the parents in debugger and found that the last parent is
javax.swing.PopupFactory$MediumWeightPopup$MediumWeightComponent[panel0,1942,211,235x17,invalid,layout=java.awt.BorderLayout]
and it's parent is null.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by myk » 12 Feb 2013, 18:18
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Who is online
Users browsing this forum: No registered users and 28 guests