OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [iwidgets3.0.0/] [demos/] [html/] [notebook.n.html] - Blame information for rev 1770

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
<HTML>
2
<HEAD>
3
<TITLE>iwidgets2.2.0 User Commands - notebook</TITLE>
4
</HEAD>
5
<BODY BGCOLOR="#FFFFFF">
6
<H1>iwidgets2.2.0 User Commands - notebook</H1>
7
<HR>
8
<PRE>
9
 
10
</PRE>
11
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
12
 
13
 
14
</PRE>
15
<H2>NAME</H2><PRE>
16
     notebook - create and manipulate notebook widgets
17
 
18
 
19
</PRE>
20
<H2>SYNOPSIS</H2><PRE>
21
     <STRONG>notebook</STRONG> <EM>pathName</EM> ?<EM>options</EM>?
22
 
23
 
24
</PRE>
25
<H2>INHERITANCE</H2><PRE>
26
     itk::Widget &lt;- notebook
27
 
28
 
29
</PRE>
30
<H2>STANDARD OPTIONS</H2><PRE>
31
     <STRONG>background</STRONG>      <STRONG>foreground</STRONG>     <STRONG>scrollCommand</STRONG>   <STRONG>width</STRONG>
32
     <STRONG>cursor</STRONG>          <STRONG>height</STRONG>
33
 
34
     See the "options" manual entry for details on  the  standard
35
     options.
36
 
37
 
38
</PRE>
39
<H2>WIDGET-SPECIFIC OPTIONS</H2><PRE>
40
     Name:           <STRONG>auto</STRONG>
41
     Class:          <STRONG>Auto</STRONG>
42
     Command-Line Switch:           <STRONG>-auto</STRONG>
43
 
44
          Specifies    whether    to    use     the     automatic
45
          packing/unpacking algorithm of the notebook. A value of
46
          <STRONG>true</STRONG> indicates that page frames will  be  unpacked  and
47
          packed  acoording  to  the  algorithm  described in the
48
          <STRONG>select</STRONG> command. A value of  <STRONG>false</STRONG>  leaves  the  current
49
          page  packed  and subsequent selects, next, or previous
50
          commands do not switch pages automatically.  In  either
51
          case   the  page's  associated  command  (see  the  <STRONG>add</STRONG>
52
          command's  description  of  the  <STRONG>command</STRONG>   option)   is
53
          invoked.  The  value may have any of the forms accepted
54
          by the <STRONG>Tcl_GetBoolean</STRONG>, such as true, false, 0, 1,  yes,
55
          or no.
56
 
57
          For example, if a series of pages in a notebook  simply
58
          change  certain  display  configurations of a graphical
59
          display, the <STRONG>-auto</STRONG> flag could be used. By  setting  it,
60
          the <STRONG>-command</STRONG> procs could do the appropriate reconfigur-
61
          ing of the page when the page is switched.
62
 
63
</PRE>
64
<H2><HR ALIGN=LEFT WIDTH=70% SIZE=3></H2><PRE>
65
 
66
 
67
</PRE>
68
<H2>DESCRIPTION</H2><PRE>
69
     The <STRONG>notebook</STRONG> command creates a  new  window  (given  by  the
70
     pathName  argument)  and  makes  it  into a notebook widget.
71
     Additional options, described above may be specified on  the
72
     command  line or in the option database to configure aspects
73
     of the notebook such as its  colors,  font,  and  text.  The
74
     <STRONG>notebook</STRONG>  command returns its <EM>pathName</EM> argument. At the time
75
     this command is invoked, there must not exist a window named
76
     pathName, but pathName's parent must exist.
77
     A notebook is a widget that contains  a  set  of  pages.  It
78
     displays  one page from the set as the selected page. When a
79
     page is selected, the page's contents are displayed  in  the
80
     page area. When first created a notebook has no pages. Pages
81
     may be added or  deleted  using  widget  commands  described
82
     below.
83
 
84
 
85
 
86
</PRE>
87
<H2>NOTEBOOK PAGES</H2><PRE>
88
     A notebook's pages area contains a single child site  <STRONG>frame</STRONG>.
89
     When  a new page is created it is a child of this frame. The
90
     page's child site frame serves as a geometry  container  for
91
     applications  to pack widgets into. It is this frame that is
92
     automatically unpacked or packed when  the  <STRONG>auto</STRONG>  option  is
93
     <STRONG>true</STRONG>. This creates the effect of one page being visible at a
94
     time. When a new page is selected, the  previously  selected
95
     page's  child  site frame is automatically unpacked from the
96
     notebook's child site frame and the  newly  selected  page's
97
     child site is packed into the notebook's child site frame.
98
 
99
     However, sometimes it is desirable to handle page changes in
100
     a  different manner. By specifying the <STRONG>auto</STRONG> option as <STRONG>false</STRONG>,
101
     child site packing can be disabled and done differently. For
102
     example,  all  widgets might be packed into the first page's
103
     child site frame. Then when a  new  page  is  selected,  the
104
     application can reconfigure the widgets and give the appear-
105
     ance that the page was flipped.
106
 
107
     In both cases the <STRONG>command</STRONG> option for a page specifies a  Tcl
108
     Command to execute when the page is selected. In the case of
109
     <STRONG>auto</STRONG> being <STRONG>true</STRONG>, it is called between the unpacking  of  the
110
     previously  selected  page  and  the  packing  of  the newly
111
     selected page.
112
 
113
 
114
 
115
</PRE>
116
<H2>WIDGET-SPECIFIC METHODS</H2><PRE>
117
     The <STRONG>notebookfR</STRONG> <STRONG>command</STRONG> <STRONG>creates</STRONG> <STRONG>a</STRONG> <STRONG>new</STRONG> <STRONG>Tcl</STRONG> <STRONG>command</STRONG> <STRONG>whose</STRONG>  <STRONG>name</STRONG>
118
     <STRONG>is</STRONG>  <EM>pathName</EM>.  This  command  may  be used to invoke various
119
     operations on the widget. It has the following general form:
120
 
121
          <EM>pathName</EM> <EM>option</EM> ?<EM>arg</EM> <EM>arg</EM> ...?
122
 
123
     <EM>option</EM> and the <EM>arg</EM>s determine the exact behavior of the com-
124
     mand.
125
 
126
     Many of the widget commands for a notebook take as one argu-
127
     ment  an  indicator of which page of the notebook to operate
128
     on. These indicators are called indexes and may be specified
129
     in any of the following forms:
130
 
131
     <EM>number</EM>
132
          Specifies the index of the the component. For menus,  0
133
          corresponds  to the left-most menu of the menu bar. For
134
          entries, 0 corresponds to the  top-most  entry  of  the
135
          menu.   <EM>number</EM>  Specifies the page numerically, where 0
136
          corresponds to the first page in the notebook, 1 to the
137
          second, and so on.
138
 
139
     <STRONG>select</STRONG>
140
          Specifies the currently selected page's  index.  If  no
141
          page is currently selected, the value -1 is returned.
142
 
143
     <STRONG>end</STRONG>  Specifes the last page in the notebooks's index. If the
144
          notebook is empty this will return -1.
145
 
146
     <EM>pattern</EM>
147
          If the index doesn't satisfy the form of a number, then
148
          this  form  is used. Pattern is pattern-matched against
149
          the <STRONG>label</STRONG> of each page in the notebook, in  order  from
150
          the  first  to the last page, until a matching entry is
151
          found. The rules of <STRONG>Tcl_StringMatch</STRONG> are used.
152
 
153
     The following commands are possible for notebook widgets:
154
 
155
     <EM>pathName</EM> <STRONG>add</STRONG> ?<EM>option</EM> <EM>value</EM>?
156
          Add a new page at the end of the notebook. A new  child
157
          site frame is created. Returns the child site pathName.
158
          If additional arguments are present, they  specify  any
159
          of the following options:
160
 
161
          <STRONG>-background</STRONG> <EM>value</EM>
162
               Specifies a background color to use for displaying
163
               the  child site frame of this page. If this option
164
               is specified as an  empty  string  (the  default),
165
               then  the  background option for the overall note-
166
               book is used.
167
 
168
          <STRONG>-command</STRONG> <EM>value</EM>
169
               Specifies a Tcl command to be executed  when  this
170
               page  is  selected.  This  allows the programmer a
171
               hook to reconfigure this  page's  widgets  or  any
172
               other page's widgets.
173
 
174
               If the notebook has the auto option set  to  true,
175
               when  a  page  is  selected  this  command will be
176
               called immediately after the  previously  selected
177
               page  is unpacked and immediately before this page
178
               is selected. The index value select is valid  dur-
179
               ing  this  Tcl command. `index select' will return
180
               this page's page number.
181
 
182
               If the auto option is set to false, when a page is
183
               selected  the  unpack and pack calls are bypassed.
184
               This Tcl command is still called.
185
 
186
          <STRONG>-foreground</STRONG> <EM>value</EM>
187
               Specifies a foreground color to use for displaying
188
               tab   labels   when   tabs  are  in  their  normal
189
               unselected state. If this option is  specified  as
190
               an empty string (the default), then the foreground
191
               option for the overall notebook is used.
192
 
193
          <STRONG>-label</STRONG> <EM>value</EM>
194
               Specifies a string to associate  with  this  page.
195
               This label serves as an additional identifier used
196
               to reference the page. This label may be used  for
197
               the index value in widget commands.
198
 
199
     <EM>pathName</EM> <STRONG>childSite</STRONG> ?<EM>index</EM>?
200
          If passed no arguments, returns a list of pathNames for
201
          all  the  pages  in  the  notebook.  If the notebook is
202
          empty, an empty list is returned
203
 
204
          If index is passed, it returns  the  pathName  for  the
205
          page's  child  site  frame  specified by index. Widgets
206
          that are created with this pathName will  be  displayed
207
          when the associated page is selected. If index is not a
208
          valid index, an empty string is returned.
209
 
210
     <EM>pathName</EM> <STRONG>cget</STRONG> <EM>option</EM>
211
          Returns the current value of the  configuration  option
212
          given by <EM>option</EM>.
213
 
214
     <EM>pathName</EM> <STRONG>configure</STRONG> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
215
          Query  or  modify  the  configuration  options  of  the
216
          widget.  If  no  <EM>option</EM>  is  specified,  returns a list
217
          describing all of the available  options  for  <EM>pathName</EM>
218
          (see  <STRONG>Tk_ConfigureInfo</STRONG> for information on the format of
219
          this list). If <EM>option</EM> is specified with no <EM>value</EM>,  then
220
          the  command  returns  a  list describing the one named
221
          option (this list will be identical to the  correspond-
222
          ing  sublist  of  the  value  returned  if no option is
223
          specified). If  one  or  more  option-value  pairs  are
224
          specified,  then  the command modifies the given widget
225
          option(s) to have the given value(s); in this case  the
226
          command returns an empty string. <EM>Option</EM> may have any of
227
          the values accepted by the <STRONG>notebook</STRONG> command.
228
 
229
     <EM>pathName</EM> <STRONG>delete</STRONG> <EM>index1</EM> ?index2?
230
          Delete all of  the  pages  between  <EM>index1</EM>  and  <EM>index2</EM>
231
          inclusive.  If  <EM>index2</EM>  is  omitted then it defaults to
232
          <EM>index1</EM>. Returns an empty string.
233
 
234
     <EM>pathName</EM> <STRONG>index</STRONG> <EM>index</EM>
235
          Returns the numerical index corresponding to <EM>index</EM>.
236
 
237
     <STRONG>pathName</STRONG> <STRONG>insert</STRONG> <EM>index</EM> ?<EM>option</EM> <EM>value</EM>?
238
          Insert a new page  in  the  notebook  before  the  page
239
          specified  by <EM>index</EM>. A new child site <STRONG>frame</STRONG> is created.
240
          See the <STRONG>add</STRONG> command  for  valid  options.  Returns  the
241
          child site pathName.
242
 
243
     <EM>pathName</EM> <STRONG>next</STRONG>
244
          Advances the selected page to the next page  (order  is
245
          determined   by  insertion  order).  If  the  currently
246
          selected page is the last page  in  the  notebook,  the
247
          selection  wraps  around to the first page in the note-
248
          book.
249
 
250
          For notebooks with auto set to true the current  page's
251
          child  site  is unpacked from the notebook's child site
252
          frame. Then the next page's child site is  packed  into
253
          the  notebooks  child site frame. The Tcl command given
254
          with the command option will be invoked  between  these
255
          two operations.
256
 
257
          For notebooks with auto set to false  the  Tcl  command
258
          given with the command option will be invoked.
259
 
260
     <EM>pathName</EM> <STRONG>pagecget</STRONG> <EM>index</EM> ?<EM>option</EM>?
261
          Returns the current value of the  configuration  option
262
          given  by  <EM>option</EM>  for the page specified by <EM>index</EM>. The
263
          valid available options are the same  as  available  to
264
          the <STRONG>add</STRONG> command.
265
 
266
     <EM>pathName</EM> <STRONG>pageconfigure</STRONG> <EM>index</EM> ?<EM>option</EM>? ?<EM>value</EM> <EM>option</EM> <EM>value</EM> ...?
267
          This  command  is  similar  to  the  configure command,
268
          except that it applies to the options for an individual
269
          page,  whereas configure applies to the options for the
270
          notebook. Options may have any of the  values  accepted
271
          by  the  add  widget command. If options are specified,
272
          options are modified as indicated in  the  command  and
273
          the  command returns an empty string. If no options are
274
          specified,  returns  a  list  describing  the   current
275
          options for page <EM>index</EM> (see <STRONG>Tk_ConfigureInfo</STRONG> for infor-
276
          mation on the format of this list).
277
 
278
     <EM>pathName</EM> <STRONG>prev</STRONG>
279
          Moves the selected page to the previous page (order  is
280
          determined   by  insertion  order).  If  the  currently
281
          selected page is the first page in  the  notebook,  the
282
          selection  wraps  around  to the last page in the note-
283
          book.
284
 
285
          For notebooks with <STRONG>auto</STRONG> set to <STRONG>true</STRONG> the current  page's
286
          child  site  is unpacked from the notebook's child site
287
          frame. Then the previous page's child  site  is  packed
288
          into  the  notebooks  child site frame. The Tcl command
289
          given with the command option will be  invoked  between
290
          these two operations.
291
 
292
          For notebooks with <STRONG>auto</STRONG> set to <STRONG>false</STRONG>  the  Tcl  command
293
          given with the command option will be invoked.
294
 
295
     <EM>pathName</EM> <STRONG>select</STRONG> <EM>index</EM>
296
          Selects the page specified by <EM>index</EM>  as  the  currently
297
          selected page.
298
 
299
          For notebooks with <STRONG>auto</STRONG> set to <STRONG>true</STRONG> the current  page's
300
          child  site  is unpacked from the notebook's child site
301
          frame. Then the index page's child site is packed  into
302
          the  notebooks  child site frame. The Tcl command given
303
          with the command option will be invoked  between  these
304
          two operations.
305
 
306
          For notebooks with <STRONG>auto</STRONG> set to <STRONG>false</STRONG>  the  Tcl  command
307
          given with the command option will be invoked.
308
 
309
     <EM>pathName</EM> <STRONG>view</STRONG>
310
          Returns the currently selected page.  This  command  is
311
          for compatibility with the scrollbar widget.
312
 
313
     <EM>pathName</EM> <STRONG>view</STRONG> <EM>index</EM>
314
          Selects the page specified by <EM>index</EM>  as  the  currently
315
          selected  page.  This command is for compatibility with
316
          the scrollbar widget.
317
 
318
     <EM>pathName</EM> <STRONG>view</STRONG> <EM>moveto</EM> <EM>fraction</EM>
319
          Uses the fraction value to determine the  corresponding
320
          page to move to. This command is for compatibility with
321
          the scrollbar widget.
322
 
323
     <EM>pathName</EM> <STRONG>view</STRONG> <EM>scroll</EM> <EM>num</EM> <EM>what</EM>
324
          Uses the <EM>num</EM> value to determine how many pages to  move
325
          forward  or backward (num can be negative or positive).
326
          The <EM>what</EM> argument is ignored. This command is for  com-
327
          patibility with the scrollbar widget.
328
 
329
 
330
 
331
</PRE>
332
<H2>EXAMPLE</H2><PRE>
333
     Following is an example that creates  a  notebook  with  two
334
     pages. In this example, we use a scrollbar widget to control
335
     the notebook widget.
336
 
337
          # Create the notebook widget and pack it.
338
            notebook .nb -width 100 -height 100
339
            pack .nb -anchor nw \
340
                  -fill both \
341
                  -expand yes \
342
                  -side left \
343
                  -padx 10 \
344
                  -pady 10
345
 
346
          # Add two pages to the notebook, labelled
347
          # "Page One" and "Page Two", respectively.
348
            .nb add -label "Page One"
349
            .nb add -label "Page Two"
350
 
351
          # Get the child site frames of these two pages.
352
            set page1CS [.nb childsite 0]
353
            set page2CS [.nb childsite "Page Two"]
354
 
355
          # Create buttons on each page of the notebook
356
            button $page1CS.b -text "Button One"
357
            pack $page1CS.b
358
            button $page2CS.b -text "Button Two"
359
            pack $page2CS.b
360
 
361
          # Select the first page of the notebook
362
            .nb select 0
363
 
364
          # Create the scrollbar and associate teh scrollbar
365
          # and the notebook together, then pack the scrollbar
366
            ScrollBar .scroll -command ".nb view"
367
            .nb configure -scrollcommand ".scroll set"
368
            pack .scroll -fill y -expand yes -pady 10
369
 
370
 
371
</PRE>
372
<H2>AUTHOR</H2><PRE>
373
     Bill W. Scott
374
 
375
 
376
</PRE>
377
<H2>KEYWORDS</H2><PRE>
378
     notebook page
379
 
380
 
381
 
382
 
383
 
384
 
385
 
386
 
387
 
388
 
389
 
390
 
391
 
392
 
393
 
394
 
395
 
396
 
397
 
398
 
399
 
400
</PRE>
401
</BODY>
402
</HTML>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.