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

Scrolled frame within a window

8 views
Skip to first unread message

Scott Parrill

unread,
Jul 31, 2012, 6:10:32 PM7/31/12
to tc...@perl.org
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: Scott....@wyo.gov<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.

Jeff Hobbs

unread,
Aug 1, 2012, 1:45:39 AM8/1/12
to Scott Parrill, tc...@perl.org
I believe this g_grid call here isn't what you want. The setwidget call above will place the widget in the parent with the correct parameters.

Scott Parrill

unread,
Aug 1, 2012, 11:30:49 AM8/1/12
to Jeff Hobbs, tc...@perl.org
Jeff,

Removing the $f->g_grid call did the trick. Thanks much!

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: Scott....@wyo.gov<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.
----------------------------------------------------------------------







0 new messages