How can I make the scrollbar work properly ???
Hi all of you guys,
Actually Im trying to make a browser tab with scrollbar (because in my situation, there are many widgets in the browser tab so we dont have enough space for them), however I could not make it work properly...!!!
If anybody who know how to do it, please help me to solve the problem.
here I attached my code for your convenience
your help will be appreciated
Thanks
------------------------------------
# making tab in the browser
proc Make_TAB { } {
lappend auto_path{<path to the folder containing hwt folder>}
package require hwt; #to import the hwt package
set tabName 'System_Parameters';
hw browser delete $tabName;
hw browser add $tabName end [ hw browser get frame $tabName ];
hw browser select $tabName;
set frm [ hw browser get frame $tabName ];
set bclose [::hwt::CanvasButton $frm.bclose [::hwt::DluWidth 8] [ ::hwt::DluHeight 8 ] \
icon msclose iconH 1 iconV 1 \
relief flat help 'Exit Program' takefocus 1 \
command 'hw browser delete $tabName' ];
pack $bclose -side top -anchor ne -padx 5 -pady 5 ;
#---- how can I make the scrollbar work properly ??? --------
set scrb [scrollbar $frm.scrb -command '$frm yview']
pack $scrb -side right -anchor nw;
#------------------------------------------------------------
set labelWidth 27;
set entryWidth 15;
#section label
set section1 [label $frm.section1 \
-text 'SYSTEM PARAMETERS' \
-justify left \
-anchor nw \
-font [hwt::AppFont]];
pack $section1 -side top -anchor nw;
hwt::AddPadding $frm -side top -height [hwt::DluHeight 5];
# frame1
set frame1 [frame $frm.frame1];
pack $frame1 -side top -anchor nw;
hwt::AddPadding $frame1 -side left -width [hwt::DluWidth 15];
set entry11 [ hwt::AddEntry $frame1.entry11 \
-label 'Mass (kg)' \
-labelWidth $labelWidth \
-entryWidth $entryWidth \
-text '' \
-textvariable mass_rocket \
-validate real \
-state normal \
-withoutPacking];
pack $entry11 -side top -anchor nw;
set entry12 [ hwt::AddEntry $frame1.entry12 \
-label 'Force (N)' \
-labelWidth $labelWidth \
-entryWidth $entryWidth \
-text '' \
-textvariable mass_b2 \
-validate real \
-state normal \
-withoutPacking];
pack $entry12 -side top -anchor nw;
hwt::AddPadding $frame1 -side bottom -height [hwt::DluWidth 380];
# buttons Load_Initial_Model, Run
set btn1 [button $frm.btn1 -width 16 -height 2 -text {Load Initial Model} -command {Open_Model}];
pack $btn1 -side left -padx 22 -pady 5 -anchor nw;
set btn2 [button $frm.btn2 -width 16 -height 2 -text {Analysis Setting} -command {Analysis}];
pack $btn2 -side left -padx 16 -pady 5 -anchor nw;
}
# end proc Make_TAB
# main code
set isFirst True;
Make_TAB;
# end main code
---------------------------
Find more posts tagged with
Dear tinh,
First Im greatly appreciated your kindness reply. Actually, I tried many times for making the textbox with scrollbar on the browser tab, however it still can not work properly ... here I attached my tcl code, if you dont mind please help me to add scrollbar so that it work properly.
your help will be highly appreciated
best regards
MDD
------------------------------
lappend auto_path{<path to the folder containing hwt folder>}
package require hwt; #to import the hwt package
set tabName 'System_Parameters';
hw browser delete $tabName;
hw browser add $tabName end [hw browser get frame $tabName];
hw browser select $tabName;
set frm [ hw browser get frame $tabName ];
set bclose [::hwt::CanvasButton $frm.bclose [::hwt::DluWidth 8] [ ::hwt::DluHeight 8 ] \
icon msclose iconH 1 iconV 1 \
relief flat help 'Exit Program' takefocus 1 \
command 'hw browser delete $tabName' ];
pack $bclose -side top -anchor ne -padx 5 -pady 5;
# -----please help me to add scrollbar with the box-----------
set box [hwt::AddCanvasBox $frm withbothScrolls]
pack $box -anchor nw -fill both -expand 1 -padx 4 -pady 4;
#-------------------------------------------------------------
# buttons Load_Initial_Model, Run
set btn1 [button $frm.btn1 -width 16 -height 2 -text {Load Initial Model} -command {Open_Model}];
pack $btn1 -side left -padx 22 -pady 5 -anchor nw;
set btn2 [button $frm.btn2 -width 16 -height 2 -text {Analysis Setting} -command {Analysis}];
pack $btn2 -side left -padx 16 -pady 5 -anchor nw;
----------------------
Hi, did you overcome the problem?
try download bwidget package and put it in hw/tcl folder
below is sample code
Hi
Maybe we cannot scroll a frame
Try using a textbox with scrollbar, and put your widgets on it
using hwt::CheckScrollBars $textName $textWidth $textHeight to add scrollbars to the textbox