File: TixGrid.pod

package info (click to toggle)
perl-tk 1%3A800.015-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,636 kB
  • ctags: 18,270
  • sloc: ansic: 195,135; perl: 37,385; makefile: 4,380; sh: 2,286; yacc: 762
file content (508 lines) | stat: -rw-r--r-- 14,533 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
#  Copyright (c) 1996, Expert Interface Technologies
#  See the file "license.terms" for information on usage and
#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#  The file man.macros and some of the macros used by this file are
#  copyrighted: (c) 1990 The Regents of the University of California.
#               (c) 1994-1995 Sun Microsystems, Inc.
#  The license terms of the Tcl/Tk distribution are in the file
#  license.tcl.

## TO CHECK:
##
## callback:  checked for defined of code ref (compare -edit*cmd)
##
## option
##	formatcmd  mentions format method but there is no format
##		   method documented
##
## methods:
## 	bdtype:    what is it? no description given
##	see:	   not documented? Not implemented??
##
## todo:	missing peaces marked by ????

=head1 NAME

Tk::TixGrid - Create and manipulate Tix Grid widgets

=for pm TixGrid/TixGrid.pm

=for category Tix Extensions

=head1 SYNOPSIS

S<    >I<$tixgrid> = I<$parent>->B<TixGrid>?(I<options>)?;

    The port of C code and bindings is done but needs
    debugging.  THERE ARE KNOWN BUGS. Work in progress ...

=head1 STANDARD OPTIONS

B<-background>
	B<-borderwidth>
	B<-cursor>
	B<-font>
	B<-foreground>
	B<-height>
	B<-highlightbackground>
	B<-highlightcolor>
	B<-highlightthickness>
	B<-padx>
	B<-pady>
	B<-relief>
	B<-selectbackground>
	B<-selectborderwidth>
	B<-selectforeground>
	B<-state>
	B<-takefocus>
	B<-width>
	B<-xscrollcommand>
	B<-yscrollcommand>

See L<Tk::options> for details of the standard options.

=head1 WIDGET-SPECIFIC OPTIONS

=over 4

=item Name:	B<browseCmd>

=item Class:	B<BrowseCmd>

=item Switch:	B<-browsecmd>

?docu here?  Not in configure output but used in bindings ??!!

If defined, gives a perl/Tk L<callback|Tk::callbacks>
to be executed when the
user browses a grid cell (This is normally the case when
the user clicks on an entry).  When this callback is called, it is
passed with two additional parameters: I<x> I<y>, where (I<x>,I<y>)
is the location of the cell that has just been clicked.

=item Name:	B<Command>

=item Class:	B<Command>

=item Switch:	B<-command>

?docu here?  Not in configure output but used in bindings ??!!

=item Name:	B<editDoneCmd>

=item Class:	B<EditDoneCmd>

=item Switch:	B<-editdonecmd>

If defined, gives a perl/Tk L<callback|Tk::callbacks>
to be executed when the
user has edited grid cell. When this callback is called, it is
passed with two additional parameters: I<x> I<y>, where (I<x>,I<y>)
is the location of the cell that has just been edited.

=item Name:	B<editNotifyCmd>

=item Class:	B<EditNotifyCmd>

=item Switch:	B<-editnotifycmd>

If defined gives a perl/Tk L<callback|Tk::callbacks>
to be executed when the user tries to edit a grid cell.
When this callback is called, it is passed with two additional
parameters: I<x> I<y>, where (I<x>,I<y>,) is the location
of the cell. This callback should return a boolean value: B<true>
indicates that the cell is editable and B<false> otherwise.

=item Name:	B<FloatingCols>

=item Class:	B<floatingCols>

=item Switch:	B<-floatingcols>

Defines the number of columns that fixed when the widget
is horizontally scrolled.  These column(s)
can be used as label(s) for the column(s).  The floating column(s)
can be configured in the B<-formatcmd> callback with the
B<formatBorder> method.  The default value is 0.

=item Name:	B<FloatingRows>

=item Class:	B<floatingRows>

=item Switch:	B<-floatingrows>

Defines the number of rows that are fixed when the widget
is vertically scrolled.  These row(s)
can be used as label(s) for the row(s).  The floating row(s)
can be configured in the B<-formatcmd> callback with the
B<formatBorder> method.  The default value is 0.

=item Name:	B<formatCmd>

=item Class:	B<FormatCmd>

=item Switch:	B<-formatcmd>

If defined, gives a perl/Tk L<callback|Tk::callbacks> to be
executed when the grid cells need to be formatted on the screen.
Normally, this callback calls the B<format> method (see below).
When this callback is called, it is passed with five additional
parameters: I<type> I<x1> I<y1> I<x2> I<y2>. I<type> gives the
logical type of the region in the grid. It may be one of the
following.

=over 8

=item B<x-region>

the horizontal margin

=item B<y-region>

the vertical margin

=item B<s-region>

the area where the horizontal and vertical margins are joined

=item B<main>

all the cells that do not fall into the above three types

=back

I<x1> I<y1> I<x2> I<y2> gives the extent of the region that needs
formatting.

=item Name:	B<leftMargin>

=item Class:	B<LeftMargin>

=item Switch:	B<-leftmargin>

In the number of cells, gives the width of vertical margin.
A zero indicates that no vertical should be drawn.

=item Name:	B<itemType>

=item Class:	B<ItemType>

=item Switch:	B<-itemtype>

?docu here?

=item Name:	B<selectMode>

=item Class:	B<SelectMode>

=item Switch:	B<-selectmode>

Specifies one of several styles for manipulating the selection.
The value of the option may be arbitrary, but the default bindings
expect it to be either B<single>, B<browse>, B<multiple>, or B<extended>;
the default value is B<single>.

=item Name:	B<selectUnit>

=item Class:	B<SelectUnit>

=item Switch:	B<-selectunit>

Specifies the selection unit. Valid values are B<cell>, B<column> or B<row>.

=item Name:	B<sizeCmd>

=item Class:	B<SizeCmd>

=item Switch:	B<-sizecmd>

?docu here?

=item Name:	B<topMargin>

=item Class:	B<TopMargin>

=item Switch:	B<-topmargin>

In the number of cells, gives the height of horizontal margin.
A zero indicates that no horizontal should be drawn.

=back

=head1 DESCRIPTION

The B<TixGrid> method creates a TixGrid new window and returns a
blessed reference of this TixGrid widget.
Additional options,
described above, may be specified on the command line or in the
option database to configure aspects of the B<TixGrid> widget
such as its cursor and relief.

A Grid widget displays its contents in a two dimensional grid of cells.
Each cell may contain one Tix display item, which may be in text,
graphics or other formats. See L<Tk::DItem> for more information
about Tix display items. Individual cells, or groups of cells,
can be formatted with a wide range of attributes, such as its color,
relief and border.

=head1 WIDGET METHODS

The B<TixGrid> method creates a TixGrid widget and returns a blessed
reference of this TixGrid widget.  This reference may be used to
invoke various operations on the widget.  It has the following general
form:

S<    >I<$tixgrid>->B<method>?(I<arg, arg, ...>)?

I<arg>s determine the exact behavior of the method. The following
methods are possible for B<TixGrid> widgets:

=over 4

=item I<$tixgrid>->B<anchor>(I<action>, I<x>, I<y>)

=item I<$tixgrid>->B<anchor>I<Action>(I<x>, I<y>)

Manipulates the B<anchor cell> of the B<TixGrid> widget.
The anchor cell is the end of the selection that is fixed
while the user is dragging out a selection with the mouse.
I<Action> can be B<clear>, B<get> or B<set>.  If I<action>
is B<clear>, I<x> and I<y> args are not accepted.

=item I<$tixgrid>->B<bdtype>(I<x>, I<y> ?,I<xbdWidth>, I<ybdWidth>?)

????

=item I<$tixgrid>->B<cget>('I<-option>')

Returns the current value of the configuration option given
by I<-option>. I<-option> may have any of the values accepted
by the B<TixGrid> constructor method.

=item I<$tixgrid>->B<configure>(?I<-option>??=>I<value>, I<-option>=>I<value>, I<...>?)

Query or modify the configuration options of the widget.
If no I<-option> is specified, returns a list describing all
of the available options for I<$tixgrid> (see B<Tk_ConfigureInfo>
for information on the format of this list.) If I<-option> is
specified with no I<value>, then the method returns a list describing
the one named option (this list will be identical to the corresponding
sublist of the value returned if no I<-option> is specified).
If one or more I<option-value> pairs are specified, then the
method modifies the given widget option(s) to have the given value(s);
in this case the method returns an empty string. I<-option> may have
any of the values accepted by the B<TixGrid> constructor method.

=item I<$tixgrid>->B<delete>(I<dim>, I<from>?, I<to>?)

=item I<$tixgrid>->B<deleteColumn>(I<from>?, I<to>?)

=item I<$tixgrid>->B<deleteRow>(I<from>?, I<to>?)

I<Dim> may be B<row> or B<column>. If I<to> is not given,
deletes a single row (or column) at the position I<from>.
If I<to> is given, deletes the range of rows (or columns)
from position I<from> through I<to>.

=item I<$tixgrid>->B<dragsite>(I<option>, I<x>, I<y>)

?docu here? not implemented :-(

=item I<$tixgrid>->B<dropsite>(I<option>, I<x>, I<y>)

?docu here? not implemented :-(

=item I<$tixgrid>->B<editApply>

If any cell is being edited, de-highlight the cell and
applies the changes.

=item I<$tixgrid>->B<editSet>(I<x>, I<y>)

Highlights the cell at (I<x>,I<y>) for editing,
if the B<-editnotify> callback returns true for this cell.

=item I<$tixgrid>->B<entrycget>(I<x>, I<y>, 'I<-option>')

Returns the current value of the configuration option given by
I<-option> of the cell at (I<x>,I<y>).  I<-option> may have any
of the values accepted by the B<set> method.

=item I<$tixgrid>->B<entryconfigure>(I<x>, I<y>?, I<-option>??=>I<value>, I<-option>=>I<value>, I<...>?)

Query or modify the configuration options of the cell at (I<x>,I<y>).
If no I<-option> is specified, returns a list describing all of the
available options for the cell (see B<Tk_ConfigureInfo> for information
on the format of this list.)  If I<-option> is specified with no
I<value>, then the method returns a list describing the one named
option (this list will be identical to the corresponding sublist
of the value returned if no I<-option> is specified.) If one or
more I<option-value> pairs are specified, then the method modifies
the given widget option(s) to have the given value(s); in this case
the method returns an empty string.  I<Option> may have any of the
values accepted by the B<set> method.

=item I<$tixgrid>->B<format>(I<option>, ?I<args>, ...?)

=item I<$tixgrid>->B<formatBorder>(I<x1,y1>, I<x2,y2>, I<options>);

=item I<$tixgrid>->B<formatGrid>(I<x1,y1>, I<x2,y2>, I<options>);

the B<format> method can only be called by the B<-formatcmd> callback
of the tixGrid widget.

?docu complete?

=item I<$tixgrid>->B<geometryinfo>(?I<width>, ?I<height>, ...?)

?docu here?  Return a list of 4 floats! Currently "{first1 last1} {first2,last2}" :-(

=item I<$tixgrid>->B<index>(I<$coordx>, I<$coordy>)

?docu here?

retuns I<(nx, ny)> of entry at position (I<$coordx>, I<$coordy>).
(??widget or screen offset??)

=item I<$tixgrid>->B<info>(I<option>, ?I<args>, ...?)

?docu here?

=item I<$tixgrid>->B<move>(I<dim>, I<from>, I<to>, I<offset>)

=item I<$tixgrid>->B<moveColumn>(I<from>, I<to>, I<offset>)

=item I<$tixgrid>->B<moveRow>(I<from>, I<to>, I<offset>)

I<Dim> may be B<row> or B<column>. Moves the range of rows
(or columns) from position I<from> through I<to> by the distance
indicated by I<offset>. For example,
I<$tixgrid>->B<moveRow>(B<2>, B<4>, B<1>) moves the rows 2,3,4
to rows 3,4,5.

=item I<$tixgrid>->B<nearest>(I<x>, I<y>)

?docu here?  screen pos (pixels) to entry (nx,ny) translation.

=item I<$tixgrid>->B<selection>(I<option>, I<x1>, I<y1> ?,I<x2>, I<y2>?)

=item I<$tixgrid>->B<selection>I<Option>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

Option one of: B<adjust>, B<clear>, B<includes>, B<set>, and B<toggle>.

x1 (y1) has not to be greater than x2 (y2), but only x2 and y2 can be 'max'.

BUG: I<selection includes>: has no visible effect (as in Tix). Eh???

BUG: I<selection clear>: only works for 0, 0, max, max (as in Tix). Eh???

When I<x2, y2> are not given they default to I<x1, y1>, respectively.

=over 8

=item I<$tixgrid>->B<selectionAdjust>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

?docu here?

=item I<$tixgrid>->B<selectionClear>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

?docu here?

=item I<$tixgrid>->B<selectionIncludes>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

?docu here?

=item I<$tixgrid>->B<selectionSet>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

?docu here?

=item I<$tixgrid>->B<selectionToggle>(I<x1>, I<y1> ?,I<x2>, I<y2>?)

?docu here?

=back

=item I<$tixgrid>->B<set>(I<x>, I<y>?, B<-itemtype>=>I<type>??, I<-option>=>I<value>, I<...>?)

Creates a new display item at the cell at (I<x>,I<y>). The optional
B<-itemtype> parameter gives the type of the display item.
An additional list of I<option-value> pairs specify options
of the display item. If a display item already exists at this cell,
the old item will be deleted automatically.

=item I<$tixgrid>->B<size>(I<dim>, I<index>?, I<-option>??=>I<value>, I<...>?)

=item I<$tixgrid>->B<sizeColumn>(I<index>?, I<-option>??=>I<value>, I<...>?)

=item I<$tixgrid>->B<sizeRow>(I<index>?, I<-option>??=>I<value>, I<...>?)

Queries or sets the size of the row or column given by I<dim> and
I<index>. I<Dim> may be B<row> or B<column>.  I<Index> may be any
non-negative integer that gives the position of a given row (or column).
I<Index> can also be the string B<default>; in this case, this method
queries or sets the default size of all rows (or columns).
When no I<option-value> pair is given, this method returns
a list containing the current size setting of the given row (or column).
When I<option-value> pairs are given, the corresponding options
of the size setting of the given row are changed. I<-option> may be
one of the following:

=over 8

=item B<-pad0> => I<pixels>

Specifies the paddings to the left of a column or the top of a row.

=item B<-pad1> => I<pixels>

Specifies the paddings to the right of a column or the bottom of a row.

=item B<-size> => I<val>

Specifies the width of a column or the height of a row.
I<Val> may be: B<auto> -- the width of the column is set
the widest cell in the column; a valid Tk screen distance
unit (see B<Tk_GetPixels>); or a real number following by the
word B<chars> (e.g. B<3.4chars>) that sets the width of the
column to the given number of characters.

=back

=item I<$tixgrid>->B<sort>(I<dimension>, I<start>, I<end>, ?I<args ...>?)

?docu here? (not supported on Win* OSs up to now)

=item I<$tixgrid>->B<unset>(I<x>, I<y>)

Clears the cell at (I<x>,I<y>) by removing its display item.

=item I<$tixgrid>->B<xview>

?docu here?

=item I<$tixgrid>->B<yview>

?docu here?

=back

=head1 BINDINGS

to be done.

=head1 SEE ALSO

L<Tk::DItem|Tk::DItem>
L<Tk::callbacks|Tk::callbacks>
L<Tk::FloatEntry|Tk::FloatEntry>

=head1 BUGS

C code and bindings of TixGrid have some bugs.

=head1 KEYWORDS

tix, tixgrid, table, display item, spreadsheet

=cut