[ 4 posts ]

Paul

  • Username: paulg
  • Joined: Fri Oct 02, 2009 6:49 am
  • Posts: 76
  • Offline
  • Profile

Change the default button for a dialog

Post Posted: Mon Jan 24, 2011 11:18 am
+0-
Hi,

I have a dialog with a couple of buttons. I need to change which button is the default button. I can make a button look like the default button by adding the class "default" but that doesn't give it focus. I tried

Code:
dialog.getButtons()[1].focus();

but that didn't do anything.

Is there a way to change the default button for a dialog or should I just add and remove the class "default" to at least indicate the preferred button?

Thanks,

Paul

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: Change the default button for a dialog

Post Posted: Mon Jan 24, 2011 11:53 am
+0-
There is an option for the button object that can be set when the Dialog is instantiated as "isDefault:true", see the example http://developer.yahoo.com/yui/examples/container/dialog-quickstart.html.

The Dialog user's guide http://developer.yahoo.com/yui/container/dialog shows how to do it after the Dialog is already defined using "dialog.cfg.queueProperty..." method.

Todd

Paul

  • Username: paulg
  • Joined: Fri Oct 02, 2009 6:49 am
  • Posts: 76
  • Offline
  • Profile
Tags:

Re: Change the default button for a dialog

Post Posted: Tue Jan 25, 2011 2:44 pm
+0-
Thanks. I already have the buttons (including a default button); I just want to reassign their roles. It looks like my best bet is to make new buttons each time I want to change them, as shown in this post:

viewtopic.php?p=4690#p4690

It's not clear to me how queueProperty and setProperty differ though, other than perhaps setProperty executes immediately.

Thanks again,

Paul

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile
Tags:

Re: Change the default button for a dialog

Post Posted: Tue Jan 25, 2011 3:18 pm
+0-
Sounds like you are close. I assume you are doing myDialog.render() prior to .show() to make sure the changes are made, correct?
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum