Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: using options.addOptionConfirmation() causes optionSelected to not get called  (Read 523 times)

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile

Class:
public class IndEvo_MyCustomSpecial extends BaseSalvageSpecial

Offending code under init():

options.addOption("text", data1);         
options.addOptionConfirmation(data1, "moreText", "Confirm", "Return");


Will result in
@Override
    public void optionSelected(String optionText, Object optionData) {}

not getting called as expected
« Last Edit: March 19, 2021, 03:25:09 PM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile

Hmm. Changing the default ship recovery special like so:
options.addOption("Not now", NOT_NOW);
options.addOptionConfirmation(NOT_NOW, "moreText", "Confirm", "Return");

Seems to work - that is, a confirmation dialog shows up, and behaves appropriately depending on which button is clicked - so I suspect something else is the problem.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile

Apologies - yes, optionSelected does work as intended.

now I just have to figure out why it doesn't display my showFleetMemberPickerDialog() when I display an optionConfirmation, but works as intended with the exact same code when I do not.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile

Ah - chaining two dialogs like that might not work, if you're trying to show another dialog in the optionSelected() from confirming in a confirmation dialog. That's probably the issue.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile

Yup, that's what I was trying to do. Thank you for your support!
Logged