subsubsection3_4_1_4.html
subsection3_4_1.html
subsubsection3_4_1_2.html
tableofcontents3_1.html
Next:
subsubsection3_4_1_4.html
Changing Page Tabs
Up:
subsection3_4_1.html
TixNoteBook
Previous:
subsubsection3_4_1_2.html
Keyboard Accelerators
Delaying the Creation of New Pages
If your notebook contains many complicated pages, it may take quite a
while to create all widgets inside these pages and your program will
probably freezes for a few seconds when it pops up the notebook for
the first time. To avoid embarrassing moments like this, we can use
the ``delayed page creation'' feature of the TixNoteBook widget.
When we create a page using the
add
method, we can specify
the optional parameter
-createcmd
so that we only need to
create the page when the user wants to see it. This is illustrated
in program 2-3:
tixNoteBook .n
.n add hd  -label "Hard Disk" -underline 0 -createcmd CreateHd
.n add net -label "Network"   -underline 0 -createCmd CreateNet
proc CreateHd {frame} {
tixControl $frame.access   -label "Access Time:"
tixControl $frame.write    -label "Write Throughput:"
tixControl $frame.read     -label "Read Througput:"
tixControl $frame.capacity -label "Capacity:"
pack $frame.access $frame.write $frame.read $frame.capacity
-side top -fill x
}
proc CreateNet {frame} {
...
}
(Figure 2-3) Delayed Page Creation
In line 2 of program 2-3, we use the
-createcmd
option to specify that the procedure
CreateHd
should be called
when the ``Hard Disk'' page needs to be created.
CreateHd
takes one argument, the frame subwidget of the page. As we can see,
program program 2-3 is not very different than program
2-2, except now we can issue less commands during the
set-up of the NoteBook widget and the interface can be started up
more quickly.
http://tix.sourceforge.net
http://tix.sourceforge.net
