Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DialogBox in Tkx?

547 views
Skip to first unread message

John

unread,
Apr 20, 2009, 2:35:49 PM4/20/09
to
I have a perl program, using ActiveState Perl 5.8 which uses Tk. I'm
trying to port it to ActiveState Perl 5.10 which only comes with Tkx,
but I can't find a DialogBox widget. What to do?

Thanks!
-- John Wiersba

Jeff Hobbs

unread,
Apr 20, 2009, 2:49:11 PM4/20/09
to
On Apr 20, 11:35 am, John <jrw32...@gmail.com> wrote:
> I have a perl program, using ActiveState Perl 5.8 which uses Tk.  I'm
> trying to port it to ActiveState Perl 5.10 which only comes with Tkx,
> but I can't find a DialogBox widget.  What to do?

Depending on how you used it, there is the tk_messageBox (called as
Tkx::tk___messageBox in translation), or tk_dialog
(Tkx::tk___dialog). There are also other megawidgets that support
more dialog shell style behavior (Tkx::package_require
('widget::dialog'); $mw->new_widget__dialog(...) ...) that could use
more docs.

Jeff

John

unread,
Apr 20, 2009, 5:35:32 PM4/20/09
to
> Depending on how you used it, there is the tk_messageBox (called as
> Tkx::tk___messageBox in translation), or tk_dialog
> (Tkx::tk___dialog).  There are also other megawidgets that support
> more dialog shell style behavior (Tkx::package_require
> ('widget::dialog'); $mw->new_widget__dialog(...) ...) that could use
> more docs.

Thanks, Jeff. I looked at ___messageBox and ___dialog, but couldn't
seem to get them to do what I want (see below).

If the megawidgets don't have docs, can I find the (hopefully, perl)
source for them somewhere under INSTALLDIR/lib? (Unfortunately, I
don't have perl 5.10 installed anymore to do a search, because I had
to reinstall perl 5.8 to get my code working again -- apparently both
perl 5.8 and perl 5.10 can't coexist on a windows pc).

What I'm doing in my perl 5.8 code is like this:

my $db = $mw->DialogBox(
-title => $title,
-buttons => [ "OK", "Cancel" ],
-default_button => "OK",
);
my $f = $db->add( "Frame" );
...
$f->pack;
my $answer = $db->Show();
if ($ans !~ /ok/i) ...

-- John


Jeff Hobbs

unread,
Apr 21, 2009, 11:53:02 AM4/21/09
to

This would translate to:

Tkx::package_require('widget::dialog');
my $db = $mw->new_widget__dialog(
-title => $title,
-type => "okcancel",
-modal => "local",
-parent => $mw,
-padding => 10,
-synchronous => 1,
);
$d->g_bind('<Key-Return>', sub { $d->close('ok'); });
my $f = $d->getframe();
... # pack things into $f
my $answer = $db->display;
if ($answer ne "ok") ...

and there are no docs for this widget except in source. :-/ Source
view of original Tcl code is at:

http://tcllib.cvs.sourceforge.net/viewvc/tcllib/tklib/modules/widget/dialog.tcl?view=markup

Jeff

John

unread,
Apr 21, 2009, 5:58:39 PM4/21/09
to
> http://tcllib.cvs.sourceforge.net/viewvc/tcllib/tklib/modules/widget/...
>
> Jeff

Thanks, Jeff -- I don't know how I would have figured that out
myself! It looks like it's going to be somewhat painful to do a
complete port to Tkx and since I have to get this working right away,
it looks like I'm temporarily stuck at ActivePerl 5.8. When I get a
little more time I will look into this more deeply.

-- John

smallpond

unread,
Apr 22, 2009, 11:34:02 AM4/22/09
to

What platform are you on? There are perl/Tk ppms for Windows
available.

geno...@gmail.com

unread,
Apr 24, 2009, 6:51:23 AM4/24/09
to

Why you didn't install Tk.

ppm install Tk

0 new messages