Thursday, May 06, 2021

Notebook Tabs with Embedded Widgets.

Ok, its of limited use but it is possible to embed user defined widgets in a notebook page tab. In all likelihood it will still be a label and a button embedded in hbox and not a list or tree view

Including custom labels does have its drawbacks, its not really practicable to use accelerators in the same way and, if any commands or substitution strings are passed then these will return label widget-ids and not the label text string.



# !/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Gnocl

set nb [gnocl::notebook]

$nb addPage [gnocl::button -text HI] AAAAA

$nb tabConfigure 0 -data 1


# label and box
set hbox [gnocl::hBox -padding 0 -borderWidth 0]
$hbox add [gnocl::label -text %_H_IHIHI]
$hbox add [gnocl::image -image %#SaveAs -stockSize smallToolBar ]


$nb label 0 $hbox

puts [$nb getLabel 0]

gnocl::window -child $nb

No comments: