I have been trying to get a window that has a frame that is scrolled and a
frame that is not scrolled. Using the very helpful post archived at
http://www.nntp.perl.org/group/perl.tcltk/2010/03/msg393.html, I think I
have gotten very close to what I want. The problem I still have is that
the widgets in the frame with the scrollbar do not move when I move the
scrollbar. I'm certain I'm missing something simple but I don't see what.
If anyone can suggest what silly little piece I have missed, I would be
grateful. Here is the code I am using:
use Tkx;
Tkx::package_require("BWidget");
$rows = 10;
$columns = 20;
$mw = Tkx::widget->new(".");
$mw->g_grid_columnconfigure(0, -weight => 1);
$mw->g_grid_rowconfigure(0, -weight => 1);
$mwf1 = $mw->new_ttk__frame();
$mwf1->g_grid(-column => 0, -row => 0, -sticky => 'ew');
$mwf1->g_grid_columnconfigure(0, -weight => 1);
$mwf1->g_grid_rowconfigure(0, -weight => 1);
$button = $mwf1->new_ttk__button(-text => 'button');
$button->g_grid(-column => 0, -row => 0);
$mwf2 = $mw->new_ttk__frame();
$mwf2->g_grid(-column => 0, -row => 1, -sticky => 'ew');
$mwf2->g_grid_columnconfigure(0, -weight => 1);
$mwf2->g_grid_rowconfigure(0, -weight => 1);
$mwsw = $mwf2->new_ScrolledWindow(-managed => 0);
$mwswf1 = $mwsw->new_ScrollableFrame();
$mwsw->setwidget($mwswf1);
$mwsw->g_grid(-column => 0, -row => 0, -sticky => 'ew');
$mwsw->g_grid_columnconfigure($mwswf1, -weight => 1);
$mwsw->g_grid_rowconfigure($mwswf1, -weight => 1);
$f = Tkx::widget->new($mwswf1->getframe());
$f->g_grid(-column => 0, -row => 0, -sticky => 'ew');
for $i (0 .. ($rows - 1)) {
for $j (0 .. ($columns - 1)) {
$cell[$i][$j] = $f->new_ttk__entry(-width => 10);
$cell[$i][$j]->g_grid(-column => $j, -row => $i, -padx => 0, -pady =>
0, -sticky => 'nsew');
$cell[$i][$j]->insert(0, "$i, $j");
}
}
Tkx::update('idletasks');
Tkx::wm_geometry($mw, "600x" . Tkx::winfo_reqheight($mw));
Thanks,
Scott
----------------------------------------------------------------------
Scott Parrill
Information Technology Specialist
Wyoming State Geological Survey
State of Wyoming
P.O. Box 1347
Laramie, WY 82073
Phone: 307-766-2286 x242
Fax: 307-766-2605
E-mail:
[email protected]<https://uwmail.uwyo.edu/owa/redir.aspx?C=4dc4ce62e583463fb8ad86380018935b&URL=mailto%3aScott.Parrill%40wyo.gov>
----------------------------------------------------------------------
E-Mail to and from me, in connection with the transaction of public
business, is subject to the Wyoming Public Records Act and may be
disclosed to third parties.
----------------------------------------------------------------------
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.