You could make an extended megawidget which would add the button, or
just encapsulate that in a simple subroutine. Did you know that it
has a '-type' option that will add a default set of button(s)?
There is a sample in the code that show you how to use this in a sync
manner (in Tcl, but easily translatable):
# Using -synchronous with a -type custom dialog requires that the
# custom buttons call [$dlg close $reason] to trigger the close
set dlg [widget::dialog .pkgerr -title "Yes/No Dialog" -separator 1 \
-parent . -type custom]
set frame [frame $dlg.f]
label $frame.lbl -text "Type Something In:"
entry $frame.ent
grid $frame.lbl $frame.ent -sticky ew
grid columnconfigure $frame 1 -weight 1
$dlg setwidget $frame
$dlg add button -text "Yes" -command [list $dlg close yes]
$dlg add button -text "No" -command [list $dlg close no]
puts [$dlg display]
Jeff
On Thu, Oct 25, 2012 at 4:06 AM, gary sachs <[email protected]> wrote:
> Jeff,
>
> any chance that widget::dialog could be enhanced to include the
> specification of a default button?
> Is there anyway to specify the "blocking synchronization" of a dialog box in
> a top-level widget?
>
> Thanks again.
>
> gary
>
> ________________________________
> From: Jeff Hobbs <[email protected]>
> To: gary sachs <[email protected]>
> Cc: 'Tcl/ Tk Mailing List' <[email protected]>
> Sent: Wednesday, October 24, 2012 11:43 PM
> Subject: Re: widget::dialog
>
> On 2012-10-23, at 4:20 AM, gary sachs <[email protected]> wrote:
>> Looking at the various option of using a dialog widget from PERL via Tkx,
>> widget::dialog was my best choice because it is themed. But I was curious
>>
>> as to why it does not allow for specifying a default button like the other
>> dialog widgets, i.e. - tk__dialog.
>
> widget::dialog tries to act like a proper dialog shell with some widget-like
> interaction and a lot of flexibility. tk_dialog is a more limited dialog
> shell only (taking just a message and names of buttons). Indeed, that's
> been replaced by the core tk_messageBox which is similarly restrictive
> because it delegates out to the native OS message box.
>
> Jeff
>