Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: [Tkx] Search for dialog box for text input

by GUIfriend (Sexton)
on Apr 23, 2012 at 10:02 UTC ( [id://966563]=note: print w/replies, xml ) Need Help??


in reply to Re: [Tkx] Search for dialog box for text input
in thread [Tkx] Search for dialog box for text input

Thank you, this link was a great help. After some effort I got the example working. Here is my result (it may help successors):
use strict; use warnings; use Tkx; my $mw = Tkx::widget->new("."); Tkx::package_require('widget::dialog'); my $db = $mw->new_widget__dialog( -title => 'MyTitle', -type => "okcancel", -modal => "local", # -parent => $mw, # -padding => 10, -synchronous => 1, ); $db->g_bind('<Key-Return>', sub { $db->close('ok'); }); my $f = $db->getframe(); my $yearval = 2012; my $weekval = 16; my $sel_fr = $db->new_ttk__frame; my $ly = $sel_fr->new_ttk__label(-text => "Year"); my $lw = $sel_fr->new_ttk__label(-text => "Week"); my $y = $sel_fr->new_ttk__spinbox( -textvariable => \$yearval, -from => 2009, -to => 2014, ); my $w = $sel_fr->new_ttk__spinbox( -textvariable => \$weekval, -from => 1, -to => 53, ); $ly->g_grid(-row => 0, -column => 0); $lw->g_grid(-row => 1, -column => 0); $y->g_grid(-row => 0, -column => 1); $w->g_grid(-row => 1, -column => 1); $sel_fr->g_pack(-in => $f); my $answer = $db->display; if ($answer ne "ok") {exit};

This solution is acceptable, but not perfect. For some reason the dialog buttons stick to the right side of the window.

In the meantime I found an alternative at http://tktable.sourceforge.net/tile/doc/dialog.html. This module has more modern syntax (options instead of positional parameters), and also additional interesting options. Unfortunately I failed already at the 1st line, translating

package require ttk::dialog

from Tcl/Tk to Perl/Tkx. Hopefully one of you monks can help me along again.

Kind regards

GUIfriend

Replies are listed 'Best First'.
Re^3: [Tkx] Search for dialog box for text input
by Anonymous Monk on Apr 23, 2012 at 12:41 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://966563]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-24 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found