#! /usr/bin/wish

# Double-click not being recognized in Gnome or Ximian on Redhat 7.2 and Redhat 9
set rt [catch {set version [package require BWidget]} err]
if {$rt != 0 } {
 tk_messageBox -icon error -type ok -title "Missing BWidgets" -message
\
  "Missing BWidgets package."
 exit
}
 
set tlist [list  "element1" "element2"]
set mainframe [MainFrame .mainframe]
 
# NoteBook creation
set frame    [$mainframe getframe]
set notebook [NoteBook $frame.nb]

# Create Top-level tab frames 
set components_frame [$notebook insert end tab1 -text "Tab1"]
# Create subordinate tab frames
set components_nb [NoteBook $components_frame.components_nb]
set frame [$components_nb insert end tab2 -text "Tab2"]
set topf  [frame $frame.topf]

 # Paned Windows
set pw1   [PanedWindow $topf.pw -side top]
set pane  [$pw1 add ]
set pw2   [PanedWindow $pane.pw2 -side left]
set tpane [$pw2 add -weight 3] 
# Major subframes
#set tbox [TitleFrame $tpane.tbox -text "Widgets"]

# Placing layout frames and major subframes
#pack $tbox -padx 2 -side left -fill both -expand yes
pack $pw1 -fill both -expand yes
pack $pw2 -fill both -expand yes 
pack $topf -fill both -expand yes 

# Types listbox
#set sw_t       [ScrolledWindow [$tbox getframe].sw -auto both]
#set tlistbox [listbox [$sw_t getframe].tlistbox -height 18 -width 20 -highlightthickness 0 -listvar ::tlist]

set tlistbox [listbox $tpane.tlistbox -height 18 -width 20 -highlightthickness 0 -listvar ::tlist] 
 
#$sw_t setwidget $tlistbox
bindtags $tlistbox [linsert [bindtags $tlistbox] 3 tlist_Tag]  
bind tlist_Tag <Double-Button-1> {puts HI}

#pack $sw_t -fill both -expand yes
pack $tlistbox -fill both -expand yes

$notebook compute_size
pack $notebook -fill both -expand yes -padx 4 -pady 4
$notebook raise [$notebook page 0]

$components_nb compute_size
pack $components_nb -fill both -expand yes -padx 4 -pady 4
$components_nb raise [$components_nb page 0]

pack $mainframe -fill both -expand yes