Skip to Content
avatar image
Former Member

Set the focus - Confirmation Dialog Box

Dear all,

We implemented the pop-up of confirmation dialog box with 'YES' and 'NO' options on click of a particular button.

But, by default the focus is on 'YES' button.

How to change the focus to 'NO' button ?

Please help me.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 07, 2009 at 05:52 AM

    Hi,

    Try this:

    IWDControllerInfo controllerInfo =
    wdControllerAPI.getViewInfo().getViewController();
    String dialogText = "Confirm Deletion";
    IWDConfirmationDialog dialog =
    wdComponentAPI.getWindowManager().createConfirmationWindow(
    dialogText,
    controllerInfo.findInEventHandlers("YES"),
    "Yes");
     
    dialog.addChoice(
    controllerInfo.findInEventHandlers("NO"), "No",true); 
    // calling the addChoice method which has three arguments addChoice(IWDEventHandlerInfo eventHandler, java.lang.String label, boolean enabled)
    dialog.open();
     
    
    

    Regards,

    Jaya.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2009 at 08:53 AM

    Hi,

    Its not possible to change the default property of dialog box, here in your case what ever you add first is focussed by default

    Check this thread also

    confirmation-dialog-box

    Regards,

    Saleem

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 07, 2009 at 03:27 AM

    Hi Wai,

    The simple solution would be just to add the No button before the yes button. The code would look like this:

    IWDControllerInfo controllerInfo =
    wdControllerAPI.getViewInfo().getViewController();
    String dialogText = "Confirm Deletion";
    IWDConfirmationDialog dialog =
    wdComponentAPI.getWindowManager().createConfirmationWindow(
    dialogText,
    controllerInfo.findInEventHandlers("NO"),
    "No");
    
    
    dialog.addChoice(
    controllerInfo.findInEventHandlers("YES"), "Yes");
    dialog.open();
    
    

    and then create two eventhandlers for Yes and No.

    I hope this helps.

    Thanks and Regards

    Pravesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Parvesh,

      Thanks for your quick response.

      We changed the sequence order of 'YES' and 'NO' buttons as specified by you.

      I think we don't have other option. Do we have ?