| shookytal 2005-05-17, 3:51 am |
| Hi All,
I’m trying to create a frame that I can add widgets (other frames) to it.
The number of frames I want to add changes according to a list length (@file).
I used a Scrolled Text widget ($files_txt_t) and added a frame at a time using windowCreate.
I have two problems:
1. When I change the size of the main window, the frames inside the Text widget stay in the same size.
2. I can’t seem to delete the frames from the Text widget (I want a button that clears the Text widget).
Can anyone please help?
I wrote the code that adds frames to the Text widget:
my $file_txt_t = $feed_list_frm->Scrolled("Text", -scrollbars=>'osoe',-width=>80, -height=>12)->pack(-fill=>'both', -expand=>1);
foreach my $line (@file) {
next if ($line =~/^\s*$/);
my $frm = $file_txt_t->Frame(-relief=>"groove", -borderwidth=>3)->pack(-fill=>'x', -expand=>1);
#$frm[$line_index] = $file_txt_t->Frame(-relief=>"groove", -borderwidth=>3)->pack(-fill=>'x', -expand=>1);
#my $frm = $file_txt_t->Frame(-relief=>"groove", -borderwidth=>3)->pack(-fill=>'x', -expand=>1);
$frm->Checkbutton(-text=>"Done", -variable=>\$feed_list_check[$line_index], -cursor=>"arrow")->pack(-side=>'left');
$feed_list_line_e[$line_index] = $frm->Scrolled("Entry", -scrollbars=>'s', -width=>68)->pack(-side=>'left',-fill=>'x', -expand=>1);
$feed_list_line_e[$line_index]->insert('end', $line);
my $btt = $frm->Button(-text=>"Go", -cursor=>"arrow", -command=>[\&feed_list_line_activate, $line_index])->pack(-side=>'right');
$file_txt_t->windowCreate('end',-window=> $frm , -stretch=>1);
$file_txt_t->insert('end', "\n");
$line_index++;
}
Thanks. |