File
tip/67.tip
— part of check-in
[7e34c5798d]
at
2003-12-19 15:21:32
on branch trunk
— Made withdrawal reasons more obvious to casual browsers.
Thanks to DGP for his feedback!
(user:
dkf
size: 5658)
0000: 54 49 50 3a 20 20 20 20 20 20 20 20 20 20 20 36 TIP: 6
0010: 37 0a 54 69 74 6c 65 3a 20 20 20 20 20 20 20 20 7.Title:
0020: 20 41 6c 6c 6f 77 20 53 75 62 63 6c 61 73 73 69 Allow Subclassi
0030: 6e 67 20 6f 66 20 74 6b 5f 67 65 74 4f 70 65 6e ng of tk_getOpen
0040: 46 69 6c 65 2c 20 74 6b 5f 67 65 74 53 61 76 65 File, tk_getSave
0050: 46 69 6c 65 20 6f 6e 20 55 4e 49 58 0a 56 65 72 File on UNIX.Ver
0060: 73 69 6f 6e 3a 20 20 20 20 20 20 20 24 52 65 76 sion: $Rev
0070: 69 73 69 6f 6e 3a 20 31 2e 35 20 24 0a 41 75 74 ision: 1.5 $.Aut
0080: 68 6f 72 3a 20 20 20 20 20 20 20 20 43 68 72 69 hor: Chri
0090: 73 20 4e 65 6c 73 6f 6e 20 3c 6e 65 6c 73 6f 6e s Nelson <nelson
00a0: 40 70 69 6e 65 62 75 73 68 2e 63 6f 6d 3e 0a 41 @pinebush.com>.A
00b0: 75 74 68 6f 72 3a 20 20 20 20 20 20 20 20 41 6c uthor: Al
00c0: 20 5a 69 65 6c 61 73 6b 6f 77 73 6b 69 20 3c 7a Zielaskowski <z
00d0: 69 65 6c 61 73 6b 6f 40 70 69 6e 65 62 75 73 68 ielasko@pinebush
00e0: 2e 63 6f 6d 3e 0a 53 74 61 74 65 3a 20 20 20 20 .com>.State:
00f0: 20 20 20 20 20 57 69 74 68 64 72 61 77 6e 0a 54 Withdrawn.T
0100: 79 70 65 3a 20 20 20 20 20 20 20 20 20 20 50 72 ype: Pr
0110: 6f 6a 65 63 74 0a 54 63 6c 2d 56 65 72 73 69 6f oject.Tcl-Versio
0120: 6e 3a 20 20 20 38 2e 35 0a 56 6f 74 65 3a 20 20 n: 8.5.Vote:
0130: 20 20 20 20 20 20 20 20 50 65 6e 64 69 6e 67 0a Pending.
0140: 43 72 65 61 74 65 64 3a 20 20 20 20 20 20 20 30 Created: 0
0150: 39 2d 4f 63 74 2d 32 30 30 31 0a 50 6f 73 74 2d 9-Oct-2001.Post-
0160: 48 69 73 74 6f 72 79 3a 0a 0a 7e 20 41 62 73 74 History:..~ Abst
0170: 72 61 63 74 0a 0a 4f 6e 20 4d 69 63 72 6f 73 6f ract..On Microso
0180: 66 74 20 57 69 6e 64 6f 77 73 20 69 74 20 69 73 ft Windows it is
0190: 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 22 73 75 possible to "su
01a0: 62 63 6c 61 73 73 22 20 61 20 73 74 61 6e 64 61 bclass" a standa
01b0: 72 64 20 64 69 61 6c 6f 67 0a 61 6e 64 20 61 64 rd dialog.and ad
01c0: 64 20 63 6f 6e 74 72 6f 6c 73 20 74 6f 20 69 74 d controls to it
01d0: 2e 20 20 54 68 69 73 20 54 49 50 20 70 72 6f 70 . This TIP prop
01e0: 6f 73 65 73 20 61 64 64 69 6e 67 20 74 68 61 74 oses adding that
01f0: 20 66 65 61 74 75 72 65 20 74 6f 20 74 68 65 0a feature to the.
0200: 27 27 74 6b 5f 67 65 74 4f 70 65 6e 46 69 6c 65 ''tk_getOpenFile
0210: 27 27 20 61 6e 64 20 27 27 74 6b 5f 67 65 74 53 '' and ''tk_getS
0220: 61 76 65 46 69 6c 65 27 27 20 64 69 61 6c 6f 67 aveFile'' dialog
0230: 73 20 66 6f 72 20 6e 6f 6e 2d 57 69 6e 64 6f 77 s for non-Window
0240: 73 0a 73 79 73 74 65 6d 73 20 28 77 68 65 72 65 s.systems (where
0250: 76 65 72 20 27 27 74 6b 66 62 6f 78 2e 74 63 6c ver ''tkfbox.tcl
0260: 27 27 20 61 6e 64 20 27 27 78 6d 66 62 6f 78 2e '' and ''xmfbox.
0270: 74 63 6c 27 27 20 61 72 65 20 75 73 65 64 20 66 tcl'' are used f
0280: 6f 72 20 74 68 65 73 65 0a 64 69 61 6c 6f 67 73 or these.dialogs
0290: 29 2e 0a 0a 7e 20 52 61 74 69 6f 6e 61 6c 65 0a )...~ Rationale.
02a0: 0a 49 6e 20 6f 75 72 20 77 6f 72 6b 20 77 69 74 .In our work wit
02b0: 68 20 54 6b 2c 20 77 65 20 68 61 76 65 20 6e 65 h Tk, we have ne
02c0: 65 64 20 74 6f 20 73 61 76 65 20 66 69 6c 65 73 ed to save files
02d0: 20 69 6e 20 76 61 72 69 6f 75 73 20 66 6f 72 6d in various form
02e0: 61 74 73 20 61 6e 64 0a 67 69 76 65 20 74 68 65 ats and.give the
02f0: 20 75 73 65 72 20 63 6f 6e 74 72 6f 6c 20 6f 76 user control ov
0300: 65 72 20 6d 6f 72 65 20 74 68 61 6e 20 6a 75 73 er more than jus
0310: 74 20 74 68 65 20 66 69 6c 65 20 6e 61 6d 65 20 t the file name
0320: 77 68 65 6e 20 73 61 76 69 6e 67 2e 0a 57 68 69 when saving..Whi
0330: 6c 65 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c le it is possibl
0340: 65 20 74 6f 20 68 61 76 65 20 74 77 6f 20 73 65 e to have two se
0350: 70 61 72 61 74 65 20 64 69 61 6c 6f 67 73 20 2d parate dialogs -
0360: 20 6f 6e 65 20 66 6f 72 20 73 70 65 63 69 66 79 one for specify
0370: 69 6e 67 0a 74 68 65 20 66 69 6c 65 20 6e 61 6d ing.the file nam
0380: 65 20 61 6e 64 20 6c 6f 63 61 74 69 6f 6e 20 61 e and location a
0390: 6e 64 20 61 6e 6f 74 68 65 72 20 66 6f 72 20 6f nd another for o
03a0: 74 68 65 72 20 61 74 74 72 69 62 75 74 65 73 20 ther attributes
03b0: 2d 20 74 68 69 73 20 69 73 0a 75 6e 77 69 65 6c - this is.unwiel
03c0: 64 79 20 61 6e 64 20 6e 6f 74 20 76 65 72 79 20 dy and not very
03d0: 75 73 65 72 20 66 72 69 65 6e 64 6c 79 3a 20 61 user friendly: a
03e0: 6c 6c 20 74 68 65 20 72 65 6c 61 74 65 64 20 69 ll the related i
03f0: 6e 66 6f 72 6d 61 74 69 6f 6e 0a 73 68 6f 75 6c nformation.shoul
0400: 64 20 62 65 20 69 6e 20 6f 6e 65 20 64 69 61 6c d be in one dial
0410: 6f 67 0a 0a 4f 6e 20 4d 69 63 72 6f 73 6f 66 74 og..On Microsoft
0420: 20 57 69 6e 64 6f 77 73 2c 20 69 74 20 69 73 20 Windows, it is
0430: 70 6f 73 73 69 62 6c 65 20 74 6f 20 61 64 64 20 possible to add
0440: 63 6f 6e 74 72 6f 6c 73 20 74 6f 20 73 74 61 6e controls to stan
0450: 64 61 72 64 0a 64 69 61 6c 6f 67 73 20 28 69 6e dard.dialogs (in
0460: 64 65 65 64 20 61 6e 79 20 77 69 6e 64 6f 77 29 deed any window)
0470: 20 76 69 61 20 22 73 75 62 63 6c 61 73 73 69 6e via "subclassin
0480: 67 22 20 28 63 66 0a 68 74 74 70 3a 2f 2f 6d 73 g" (cf.http://ms
0490: 64 6e 2e 6d 69 63 72 6f 73 6f 66 74 2e 63 6f 6d dn.microsoft.com
04a0: 2f 6c 69 62 72 61 72 79 2f 64 65 66 61 75 6c 74 /library/default
04b0: 2e 61 73 70 3f 75 72 6c 3d 2f 6c 69 62 72 61 72 .asp?url=/librar
04c0: 79 2f 65 6e 2d 75 73 2f 77 69 6e 75 69 2f 63 6f y/en-us/winui/co
04d0: 6d 6d 64 6c 67 5f 34 71 6c 76 2e 61 73 70 29 2e mmdlg_4qlv.asp).
04e0: 0a 28 54 68 69 73 20 72 65 71 75 69 72 65 73 20 .(This requires
04f0: 43 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 62 75 C programming bu
0500: 74 20 69 74 20 69 73 2c 20 61 74 20 6c 65 61 73 t it is, at leas
0510: 74 2c 20 70 6f 73 73 69 62 6c 65 2e 29 0a 0a 4f t, possible.)..O
0520: 6e 20 55 4e 49 58 2c 20 6e 6f 20 67 65 6e 65 72 n UNIX, no gener
0530: 69 63 20 74 65 63 68 6e 69 71 75 65 20 6c 69 6b ic technique lik
0540: 65 20 73 75 62 63 6c 61 73 73 69 6e 67 20 65 78 e subclassing ex
0550: 69 73 74 73 2e 20 20 45 76 65 6e 20 69 66 20 77 ists. Even if w
0560: 65 0a 77 69 73 68 65 64 20 74 6f 20 69 6e 76 61 e.wished to inva
0570: 64 65 20 74 68 65 20 22 73 74 61 6e 64 61 72 64 de the "standard
0580: 20 64 69 61 6c 6f 67 2c 22 20 2d 20 6c 65 61 72 dialog," - lear
0590: 6e 69 6e 67 20 61 62 6f 75 74 20 74 68 65 20 77 ning about the w
05a0: 69 6e 64 6f 77 27 73 0a 6f 72 67 61 6e 69 7a 61 indow's.organiza
05b0: 74 69 6f 6e 2c 20 61 64 64 69 6e 67 20 77 69 64 tion, adding wid
05c0: 67 65 74 73 20 68 65 72 65 20 61 6e 64 20 74 68 gets here and th
05d0: 65 72 65 20 2d 20 63 61 6c 6c 69 6e 67 0a 27 27 ere - calling.''
05e0: 74 6b 5f 67 65 74 53 61 76 65 46 69 6c 65 27 27 tk_getSaveFile''
05f0: 20 62 6c 6f 63 6b 73 20 74 68 65 20 63 61 6c 6c blocks the call
0600: 65 72 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 er and then retu
0610: 72 6e 73 20 61 20 76 61 6c 75 65 20 61 66 74 65 rns a value afte
0620: 72 0a 74 68 65 20 64 69 61 6c 6f 67 20 69 73 20 r.the dialog is
0630: 64 65 73 74 72 6f 79 65 64 20 73 6f 20 77 65 20 destroyed so we
0640: 68 61 76 65 20 6e 6f 20 6f 70 70 6f 72 74 75 6e have no opportun
0650: 69 74 79 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 ity to manipulat
0660: 65 20 74 68 65 0a 64 69 61 6c 6f 67 2e 20 20 54 e the.dialog. T
0670: 6f 20 77 6f 72 6b 20 61 72 6f 75 6e 64 20 74 68 o work around th
0680: 69 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 68 is, we need to h
0690: 61 76 65 20 27 27 74 6b 5f 67 65 74 53 61 76 65 ave ''tk_getSave
06a0: 46 69 6c 65 27 27 20 63 61 6c 6c 0a 62 61 63 6b File'' call.back
06b0: 20 69 6e 74 6f 20 75 73 65 72 20 63 6f 64 65 20 into user code
06c0: 74 6f 20 61 64 64 20 63 6f 6e 74 72 6f 6c 73 20 to add controls
06d0: 77 68 65 6e 20 74 68 65 20 64 69 61 6c 6f 67 20 when the dialog
06e0: 69 73 20 62 75 69 6c 74 2e 0a 0a 7e 20 53 70 65 is built...~ Spe
06f0: 63 69 66 69 63 61 74 69 6f 6e 0a 0a 57 65 20 61 cification..We a
0700: 64 64 20 61 20 27 27 2d 73 75 62 63 6c 61 73 73 dd a ''-subclass
0710: 27 27 20 6f 70 74 69 6f 6e 20 74 6f 20 27 27 74 '' option to ''t
0720: 6b 5f 67 65 74 53 61 76 65 46 69 6c 65 27 27 20 k_getSaveFile''
0730: 61 6e 64 0a 27 27 74 6b 5f 67 65 74 4f 70 65 6e and.''tk_getOpen
0740: 46 69 6c 65 27 27 20 28 6f 6e 20 55 4e 49 58 20 File'' (on UNIX
0750: 6f 6e 6c 79 29 2e 20 20 54 68 65 20 76 61 6c 75 only). The valu
0760: 65 20 6f 66 20 74 68 65 20 27 27 2d 73 75 62 63 e of the ''-subc
0770: 6c 61 73 73 27 27 0a 6f 70 74 69 6f 6e 20 69 73 lass''.option is
0780: 20 61 20 54 63 6c 20 63 6f 6d 6d 61 6e 64 20 74 a Tcl command t
0790: 6f 20 65 76 61 6c 75 61 74 65 20 74 6f 20 66 69 o evaluate to fi
07a0: 6c 6c 20 61 6e 20 65 78 74 72 61 20 66 72 61 6d ll an extra fram
07b0: 65 20 6e 65 61 72 20 74 68 65 0a 62 6f 74 74 6f e near the.botto
07c0: 6d 20 6f 66 20 74 68 65 20 64 69 61 6c 6f 67 2e m of the dialog.
07d0: 20 20 57 68 65 6e 20 74 68 65 20 64 69 61 6c 6f When the dialo
07e0: 67 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 g is constructed
07f0: 2c 20 74 68 65 20 73 75 62 63 6c 61 73 73 0a 63 , the subclass.c
0800: 6f 6d 6d 61 6e 64 2c 20 69 66 20 61 6e 79 2c 20 ommand, if any,
0810: 69 73 20 65 76 61 6c 75 61 74 65 64 20 77 69 74 is evaluated wit
0820: 68 20 74 68 65 20 70 61 74 68 20 74 6f 20 74 68 h the path to th
0830: 65 20 66 72 61 6d 65 20 61 70 70 65 6e 64 65 64 e frame appended
0840: 20 61 73 0a 61 6e 20 61 64 64 69 74 69 6f 6e 61 as.an additiona
0850: 6c 20 61 72 67 75 6d 65 6e 74 2e 20 20 54 68 65 l argument. The
0860: 20 73 75 62 63 6c 61 73 73 20 63 6f 6d 6d 61 6e subclass comman
0870: 64 20 63 61 6e 20 74 68 65 6e 20 66 69 6c 6c 20 d can then fill
0880: 74 68 65 20 66 72 61 6d 65 0a 61 73 20 6e 65 65 the frame.as nee
0890: 64 65 64 2e 0a 0a 4e 6f 20 61 64 64 69 74 69 6f ded...No additio
08a0: 6e 61 6c 20 73 65 6d 61 6e 74 69 63 20 63 68 61 nal semantic cha
08b0: 6e 67 65 73 20 61 72 65 20 6e 65 65 64 65 64 20 nges are needed
08c0: 66 6f 72 20 74 68 65 73 65 20 61 64 64 69 74 69 for these additi
08d0: 6f 6e 61 6c 0a 63 6f 6e 74 72 6f 6c 73 20 74 6f onal.controls to
08e0: 20 63 6f 6d 6d 75 6e 69 63 61 74 65 20 77 69 74 communicate wit
08f0: 68 20 74 68 65 20 70 72 6f 67 72 61 6d 20 61 73 h the program as
0900: 20 73 75 63 68 20 63 6f 6d 6d 75 6e 69 63 61 74 such communicat
0910: 69 6f 6e 20 63 61 6e 20 62 65 0a 64 6f 6e 65 20 ion can be.done
0920: 74 68 72 6f 75 67 68 20 73 69 64 65 20 65 66 66 through side eff
0930: 65 63 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 ects. For examp
0940: 6c 65 2c 20 75 73 65 72 20 69 6e 74 65 72 61 63 le, user interac
0950: 74 69 6f 6e 20 77 69 74 68 20 61 0a 63 68 65 63 tion with a.chec
0960: 6b 62 6f 78 20 63 72 65 61 74 65 64 20 62 79 20 kbox created by
0970: 74 68 65 20 73 75 62 63 6c 61 73 73 20 63 6f 6d the subclass com
0980: 6d 61 6e 64 20 63 61 6e 20 62 65 20 64 65 74 65 mand can be dete
0990: 63 74 65 64 20 61 66 74 65 72 20 74 68 65 0a 27 cted after the.'
09a0: 27 74 6b 5f 67 65 74 53 61 76 65 46 69 6c 65 27 'tk_getSaveFile'
09b0: 27 20 64 69 61 6c 6f 67 20 69 73 20 63 6c 6f 73 ' dialog is clos
09c0: 65 64 20 62 79 20 65 78 61 6d 69 6e 69 6e 67 20 ed by examining
09d0: 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 the value of the
09e0: 0a 63 68 65 63 6b 62 6f 78 27 73 20 67 6c 6f 62 .checkbox's glob
09f0: 61 6c 20 76 61 72 69 61 62 6c 65 2e 0a 0a 7e 20 al variable...~
0a00: 52 65 66 65 72 65 6e 63 65 20 49 6d 70 6c 65 6d Reference Implem
0a10: 65 6e 74 61 74 69 6f 6e 0a 0a 54 68 69 73 20 70 entation..This p
0a20: 72 6f 70 6f 73 61 6c 20 68 61 73 20 62 65 65 6e roposal has been
0a30: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 implemented by
0a40: 41 6c 20 5a 69 65 6c 61 73 6b 6f 77 73 6b 69 2e Al Zielaskowski.
0a50: 20 20 41 20 70 61 74 63 68 0a 72 65 6c 61 74 69 A patch.relati
0a60: 76 65 20 74 6f 20 54 6b 20 38 2e 34 61 33 20 66 ve to Tk 8.4a3 f
0a70: 6f 6c 6c 6f 77 73 3a 0a 0a 7c 49 6e 64 65 78 3a ollows:..|Index:
0a80: 20 74 6b 66 62 6f 78 2e 74 63 6c 0a 7c 3d 3d 3d tkfbox.tcl.|===
0a90: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0aa0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0ab0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0ac0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0ad0: 0a 7c 52 43 53 20 66 69 6c 65 3a 20 2f 70 74 69 .|RCS file: /pti
0ae0: 2f 70 72 6f 64 2f 6d 72 64 2f 43 76 73 52 65 70 /prod/mrd/CvsRep
0af0: 6f 73 69 74 6f 72 79 2f 74 63 6c 2f 74 6b 2f 6c ository/tcl/tk/l
0b00: 69 62 72 61 72 79 2f 74 6b 66 62 6f 78 2e 74 63 ibrary/tkfbox.tc
0b10: 6c 2c 76 0a 7c 72 65 74 72 69 65 76 69 6e 67 20 l,v.|retrieving
0b20: 72 65 76 69 73 69 6f 6e 20 31 2e 31 2e 31 2e 31 revision 1.1.1.1
0b30: 0a 7c 64 69 66 66 20 2d 75 20 2d 77 20 2d 72 31 .|diff -u -w -r1
0b40: 2e 31 2e 31 2e 31 20 74 6b 66 62 6f 78 2e 74 63 .1.1.1 tkfbox.tc
0b50: 6c 0a 7c 2d 2d 2d 20 74 6b 66 62 6f 78 2e 74 63 l.|--- tkfbox.tc
0b60: 6c 20 20 32 30 30 31 2f 30 39 2f 30 34 20 32 33 l 2001/09/04 23
0b70: 3a 35 31 3a 31 32 20 20 20 20 20 31 2e 31 2e 31 :51:12 1.1.1
0b80: 2e 31 0a 7c 2b 2b 2b 20 74 6b 66 62 6f 78 2e 74 .1.|+++ tkfbox.t
0b90: 63 6c 20 20 32 30 30 31 2f 31 30 2f 30 39 20 31 cl 2001/10/09 1
0ba0: 39 3a 34 37 3a 35 30 0a 7c 40 40 20 2d 38 39 38 9:47:50.|@@ -898
0bb0: 2c 36 20 2b 38 39 38 2c 37 20 40 40 0a 7c 20 20 ,6 +898,7 @@.|
0bc0: 20 20 20 20 20 20 7b 2d 69 6e 69 74 69 61 6c 66 {-initialf
0bd0: 69 6c 65 20 22 22 20 22 22 20 22 22 7d 0a 7c 20 ile "" "" ""}.|
0be0: 20 20 20 20 20 20 20 7b 2d 70 61 72 65 6e 74 20 {-parent
0bf0: 22 22 20 22 22 20 22 2e 22 7d 0a 7c 20 20 20 20 "" "" "."}.|
0c00: 20 20 20 20 7b 2d 74 69 74 6c 65 20 22 22 20 22 {-title "" "
0c10: 22 20 22 22 7d 0a 7c 2b 20 20 20 20 20 20 20 7b " ""}.|+ {
0c20: 2d 73 75 62 63 6c 61 73 73 20 22 22 20 22 22 20 -subclass "" ""
0c30: 22 22 7d 0a 7c 20 20 20 20 20 7d 0a 7c 20 0a 7c ""}.| }.| .|
0c40: 20 20 20 20 20 23 20 54 68 65 20 22 2d 6d 75 6c # The "-mul
0c50: 74 69 70 6c 65 22 20 6f 70 74 69 6f 6e 20 69 73 tiple" option is
0c60: 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 only available
0c70: 66 6f 72 20 74 68 65 20 22 6f 70 65 6e 22 20 66 for the "open" f
0c80: 69 6c 65 20 64 69 61 6c 6f 67 2e 0a 7c 40 40 20 ile dialog..|@@
0c90: 2d 31 30 38 37 2c 39 20 2b 31 30 38 38 2c 32 32 -1087,9 +1088,22
0ca0: 20 40 40 0a 7c 20 20 20 20 20 23 20 50 61 63 6b @@.| # Pack
0cb0: 20 61 6c 6c 20 74 68 65 20 66 72 61 6d 65 73 20 all the frames
0cc0: 74 6f 67 65 74 68 65 72 2e 20 57 65 20 61 72 65 together. We are
0cd0: 20 64 6f 6e 65 20 77 69 74 68 20 77 69 64 67 65 done with widge
0ce0: 74 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 2e 0a t construction..
0cf0: 7c 20 20 20 20 20 23 0a 7c 20 20 20 20 20 70 61 | #.| pa
0d00: 63 6b 20 24 66 31 20 2d 73 69 64 65 20 74 6f 70 ck $f1 -side top
0d10: 20 2d 66 69 6c 6c 20 78 20 2d 70 61 64 79 20 34 -fill x -pady 4
0d20: 0a 7c 2b 0a 7c 2b 20 20 20 20 23 0a 7c 2b 20 20 .|+.|+ #.|+
0d30: 20 20 23 20 41 64 64 20 74 68 65 20 75 73 65 72 # Add the user
0d40: 27 73 20 73 75 62 63 6c 61 73 73 20 66 72 61 6d 's subclass fram
0d50: 65 20 69 66 20 6f 6e 65 20 77 61 73 20 73 70 65 e if one was spe
0d60: 63 69 66 69 65 64 0a 7c 2b 20 20 20 20 23 0a 7c cified.|+ #.|
0d70: 2b 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 + if {[string
0d80: 20 6c 65 6e 67 74 68 20 24 64 61 74 61 28 2d 73 length $data(-s
0d90: 75 62 63 6c 61 73 73 29 5d 7d 20 7b 0a 7c 2b 20 ubclass)]} {.|+
0da0: 20 20 20 20 20 20 66 72 61 6d 65 20 24 77 2e 73 frame $w.s
0db0: 75 62 63 6c 61 73 73 20 2d 62 64 20 30 0a 7c 2b ubclass -bd 0.|+
0dc0: 20 20 20 20 20 20 20 70 61 63 6b 20 24 77 2e 73 pack $w.s
0dd0: 75 62 63 6c 61 73 73 20 2d 73 69 64 65 20 62 6f ubclass -side bo
0de0: 74 74 6f 6d 20 2d 66 69 6c 6c 20 78 20 5c 0a 7c ttom -fill x \.|
0df0: 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +
0e00: 20 2d 70 61 64 78 20 5b 6c 69 73 74 20 5b 65 78 -padx [list [ex
0e10: 70 72 20 5b 77 69 6e 66 6f 20 72 65 71 77 69 64 pr [winfo reqwid
0e20: 74 68 20 24 64 61 74 61 28 74 79 70 65 4d 65 6e th $data(typeMen
0e30: 75 4c 61 62 29 5d 20 2b 20 38 5d 20 5c 0a 7c 2b uLab)] + 8] \.|+
0e40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
0e50: 65 78 70 72 20 5b 77 69 6e 66 6f 20 72 65 71 77 expr [winfo reqw
0e60: 69 64 74 68 20 24 64 61 74 61 28 6f 6b 42 74 6e idth $data(okBtn
0e70: 29 5d 20 2b 20 38 5d 5d 0a 7c 2b 20 20 20 20 20 )] + 8]].|+
0e80: 20 20 65 76 61 6c 20 24 64 61 74 61 28 2d 73 75 eval $data(-su
0e90: 62 63 6c 61 73 73 29 20 24 77 2e 73 75 62 63 6c bclass) $w.subcl
0ea0: 61 73 73 0a 7c 2b 20 20 20 20 7d 0a 7c 2b 0a 7c ass.|+ }.|+.|
0eb0: 20 20 20 20 20 70 61 63 6b 20 24 66 33 20 2d 73 pack $f3 -s
0ec0: 69 64 65 20 62 6f 74 74 6f 6d 20 2d 66 69 6c 6c ide bottom -fill
0ed0: 20 78 0a 7c 20 20 20 20 20 70 61 63 6b 20 24 66 x.| pack $f
0ee0: 32 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d 2 -side bottom -
0ef0: 66 69 6c 6c 20 78 0a 7c 20 20 20 20 20 70 61 63 fill x.| pac
0f00: 6b 20 24 64 61 74 61 28 69 63 6f 6e 73 29 20 2d k $data(icons) -
0f10: 65 78 70 61 6e 64 20 79 65 73 20 2d 66 69 6c 6c expand yes -fill
0f20: 20 62 6f 74 68 20 2d 70 61 64 78 20 34 20 2d 70 both -padx 4 -p
0f30: 61 64 79 20 31 0a 7c 2b 0a 7c 20 0a 7c 20 20 20 ady 1.|+.| .|
0f40: 20 20 23 20 53 65 74 20 75 70 20 74 68 65 20 65 # Set up the e
0f50: 76 65 6e 74 20 68 61 6e 64 6c 65 72 73 20 74 68 vent handlers th
0f60: 61 74 20 61 72 65 20 63 6f 6d 6d 6f 6e 20 74 6f at are common to
0f70: 20 44 69 72 65 63 74 6f 72 79 20 61 6e 64 20 46 Directory and F
0f80: 69 6c 65 20 44 69 61 6c 6f 67 73 0a 7c 20 20 20 ile Dialogs.|
0f90: 20 20 23 0a 7c 49 6e 64 65 78 3a 20 78 6d 66 62 #.|Index: xmfb
0fa0: 6f 78 2e 74 63 6c 0a 7c 3d 3d 3d 3d 3d 3d 3d 3d ox.tcl.|========
0fb0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0fc0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0fd0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0fe0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 7c 52 43 53 ===========.|RCS
0ff0: 20 66 69 6c 65 3a 20 2f 70 74 69 2f 70 72 6f 64 file: /pti/prod
1000: 2f 6d 72 64 2f 43 76 73 52 65 70 6f 73 69 74 6f /mrd/CvsReposito
1010: 72 79 2f 74 63 6c 2f 74 6b 2f 6c 69 62 72 61 72 ry/tcl/tk/librar
1020: 79 2f 78 6d 66 62 6f 78 2e 74 63 6c 2c 76 0a 7c y/xmfbox.tcl,v.|
1030: 72 65 74 72 69 65 76 69 6e 67 20 72 65 76 69 73 retrieving revis
1040: 69 6f 6e 20 31 2e 31 2e 31 2e 31 0a 7c 64 69 66 ion 1.1.1.1.|dif
1050: 66 20 2d 75 20 2d 77 20 2d 72 31 2e 31 2e 31 2e f -u -w -r1.1.1.
1060: 31 20 78 6d 66 62 6f 78 2e 74 63 6c 0a 7c 2d 2d 1 xmfbox.tcl.|--
1070: 2d 20 78 6d 66 62 6f 78 2e 74 63 6c 20 20 32 30 - xmfbox.tcl 20
1080: 30 31 2f 30 39 2f 30 34 20 32 33 3a 35 31 3a 31 01/09/04 23:51:1
1090: 32 20 20 20 20 20 31 2e 31 2e 31 2e 31 0a 7c 2b 2 1.1.1.1.|+
10a0: 2b 2b 20 78 6d 66 62 6f 78 2e 74 63 6c 20 20 32 ++ xmfbox.tcl 2
10b0: 30 30 31 2f 31 30 2f 30 39 20 31 39 3a 30 35 3a 001/10/09 19:05:
10c0: 35 37 0a 7c 40 40 20 2d 32 31 36 2c 36 20 2b 32 57.|@@ -216,6 +2
10d0: 31 36 2c 37 20 40 40 0a 7c 20 20 20 20 20 20 20 16,7 @@.|
10e0: 20 7b 2d 69 6e 69 74 69 61 6c 66 69 6c 65 20 22 {-initialfile "
10f0: 22 20 22 22 20 22 22 7d 0a 7c 20 20 20 20 20 20 " "" ""}.|
1100: 20 20 7b 2d 70 61 72 65 6e 74 20 22 22 20 22 22 {-parent "" ""
1110: 20 22 2e 22 7d 0a 7c 20 20 20 20 20 20 20 20 7b "."}.| {
1120: 2d 74 69 74 6c 65 20 22 22 20 22 22 20 22 22 7d -title "" "" ""}
1130: 0a 7c 2b 20 20 20 20 20 20 20 7b 2d 73 75 62 63 .|+ {-subc
1140: 6c 61 73 73 20 22 22 20 22 22 20 22 22 7d 0a 7c lass "" "" ""}.|
1150: 20 20 20 20 20 7d 0a 7c 20 20 20 20 20 69 66 20 }.| if
1160: 7b 20 5b 73 74 72 69 6e 67 20 65 71 75 61 6c 20 { [string equal
1170: 24 74 79 70 65 20 22 6f 70 65 6e 22 5d 20 7d 20 $type "open"] }
1180: 7b 0a 7c 20 20 20 20 20 20 20 20 6c 61 70 70 65 {.| lappe
1190: 6e 64 20 73 70 65 63 73 20 7b 2d 6d 75 6c 74 69 nd specs {-multi
11a0: 70 6c 65 20 22 22 20 22 22 20 22 30 22 7d 0a 7c ple "" "" "0"}.|
11b0: 40 40 20 2d 32 37 37 2c 36 20 2b 32 37 38 2c 37 @@ -277,6 +278,7
11c0: 20 40 40 0a 7c 20 20 20 20 20 69 66 20 7b 21 5b @@.| if {![
11d0: 77 69 6e 66 6f 20 65 78 69 73 74 73 20 24 64 61 winfo exists $da
11e0: 74 61 28 2d 70 61 72 65 6e 74 29 5d 7d 20 7b 0a ta(-parent)]} {.
11f0: 7c 20 20 20 20 20 20 20 20 65 72 72 6f 72 20 22 | error "
1200: 62 61 64 20 77 69 6e 64 6f 77 20 70 61 74 68 20 bad window path
1210: 6e 61 6d 65 20 5c 22 24 64 61 74 61 28 2d 70 61 name \"$data(-pa
1220: 72 65 6e 74 29 5c 22 22 0a 7c 20 20 20 20 20 7d rent)\"".| }
1230: 0a 7c 2b 0a 7c 20 7d 0a 7c 20 0a 7c 20 23 20 3a .|+.| }.| .| # :
1240: 3a 74 6b 3a 3a 4d 6f 74 69 66 46 44 69 61 6c 6f :tk::MotifFDialo
1250: 67 5f 42 75 69 6c 64 55 49 20 2d 2d 0a 7c 40 40 g_BuildUI --.|@@
1260: 20 2d 33 36 30 2c 36 20 2b 33 36 32 2c 31 37 20 -360,6 +362,17
1270: 40 40 0a 7c 20 0a 7c 20 20 20 20 20 70 61 63 6b @@.| .| pack
1280: 20 24 62 6f 74 2e 6f 6b 20 24 62 6f 74 2e 66 69 $bot.ok $bot.fi
1290: 6c 74 65 72 20 24 62 6f 74 2e 63 61 6e 63 65 6c lter $bot.cancel
12a0: 20 2d 70 61 64 78 20 31 30 20 2d 70 61 64 79 20 -padx 10 -pady
12b0: 31 30 20 2d 65 78 70 61 6e 64 20 79 65 73 20 5c 10 -expand yes \
12c0: 0a 7c 20 20 20 20 20 20 20 20 2d 73 69 64 65 20 .| -side
12d0: 6c 65 66 74 0a 7c 2b 0a 7c 2b 0a 7c 2b 20 20 20 left.|+.|+.|+
12e0: 20 23 0a 7c 2b 20 20 20 20 23 20 41 64 64 20 74 #.|+ # Add t
12f0: 68 65 20 75 73 65 72 27 73 20 73 75 62 63 6c 61 he user's subcla
1300: 73 73 20 66 72 61 6d 65 20 69 66 20 6f 6e 65 20 ss frame if one
1310: 77 61 73 20 73 70 65 63 69 66 69 65 64 0a 7c 2b was specified.|+
1320: 20 20 20 20 23 0a 7c 2b 20 20 20 20 69 66 20 7b #.|+ if {
1330: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
1340: 64 61 74 61 28 2d 73 75 62 63 6c 61 73 73 29 5d data(-subclass)]
1350: 7d 20 7b 0a 7c 2b 20 20 20 20 20 20 20 66 72 61 } {.|+ fra
1360: 6d 65 20 24 66 33 2e 73 75 62 63 6c 61 73 73 20 me $f3.subclass
1370: 2d 62 64 20 30 0a 7c 2b 20 20 20 20 20 20 20 70 -bd 0.|+ p
1380: 61 63 6b 20 24 66 33 2e 73 75 62 63 6c 61 73 73 ack $f3.subclass
1390: 20 2d 73 69 64 65 20 62 6f 74 74 6f 6d 20 2d 66 -side bottom -f
13a0: 69 6c 6c 20 78 20 2d 70 61 64 78 20 34 20 2d 70 ill x -padx 4 -p
13b0: 61 64 79 20 34 0a 7c 2b 20 20 20 20 20 20 20 65 ady 4.|+ e
13c0: 76 61 6c 20 24 64 61 74 61 28 2d 73 75 62 63 6c val $data(-subcl
13d0: 61 73 73 29 20 24 66 33 2e 73 75 62 63 6c 61 73 ass) $f3.subclas
13e0: 73 0a 7c 2b 20 20 20 20 7d 0a 7c 2b 0a 7c 20 0a s.|+ }.|+.| .
13f0: 7c 20 20 20 20 20 23 20 43 72 65 61 74 65 20 74 | # Create t
1400: 68 65 20 62 69 6e 64 69 6e 67 73 3a 0a 7c 20 20 he bindings:.|
1410: 20 20 20 23 0a 0a 7e 20 4e 6f 74 69 63 65 20 6f #..~ Notice o
1420: 66 20 57 69 74 68 64 72 61 77 61 6c 0a 0a 54 68 f Withdrawal..Th
1430: 69 73 20 54 49 50 20 77 61 73 20 57 69 74 68 64 is TIP was Withd
1440: 72 61 77 6e 20 62 79 20 74 68 65 20 54 49 50 20 rawn by the TIP
1450: 45 64 69 74 6f 72 20 66 6f 6c 6c 6f 77 69 6e 67 Editor following
1460: 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 6e 20 74 discussion on t
1470: 68 65 0a 74 63 6c 2d 63 6f 72 65 20 6d 61 69 6c he.tcl-core mail
1480: 69 6e 67 20 6c 69 73 74 2e 20 20 54 68 65 20 66 ing list. The f
1490: 6f 6c 6c 6f 77 69 6e 67 20 69 73 20 61 20 73 75 ollowing is a su
14a0: 6d 6d 61 72 79 20 6f 66 20 72 65 61 73 6f 6e 73 mmary of reasons
14b0: 20 66 6f 72 0a 77 69 74 68 64 72 61 77 61 6c 3a for.withdrawal:
14c0: 0a 0a 20 3e 20 54 68 69 73 20 77 6f 75 6c 64 20 .. > This would
14d0: 6d 61 6b 65 20 70 6f 72 74 69 6e 67 20 63 6f 64 make porting cod
14e0: 65 20 62 65 74 77 65 65 6e 20 70 6c 61 74 66 6f e between platfo
14f0: 72 6d 73 20 6f 62 73 63 65 6e 65 6c 79 20 64 69 rms obscenely di
1500: 66 66 69 63 75 6c 74 0a 20 20 20 61 73 20 74 68 fficult. as th
1510: 65 72 65 20 69 73 20 6e 6f 20 77 61 79 20 66 6f ere is no way fo
1520: 72 20 74 68 65 20 73 75 62 63 6c 61 73 73 69 6e r the subclassin
1530: 67 20 74 6f 20 77 6f 72 6b 20 74 68 65 20 73 61 g to work the sa
1540: 6d 65 20 77 61 79 20 6f 6e 20 61 6c 6c 0a 20 20 me way on all.
1550: 20 70 6c 61 74 66 6f 72 6d 73 2e 20 20 42 65 74 platforms. Bet
1560: 74 65 72 20 66 6f 72 20 70 65 6f 70 6c 65 20 74 ter for people t
1570: 6f 20 72 6f 6c 6c 20 74 68 65 69 72 20 6f 77 6e o roll their own
1580: 2c 20 70 65 72 68 61 70 73 20 73 74 61 72 74 69 , perhaps starti
1590: 6e 67 0a 20 20 20 66 72 6f 6d 20 74 68 65 20 66 ng. from the f
15a0: 6f 75 6e 64 61 74 69 6f 6e 73 20 6f 66 20 74 68 oundations of th
15b0: 65 20 55 4e 49 58 20 66 69 6c 65 20 62 72 6f 77 e UNIX file brow
15c0: 73 69 6e 67 20 63 6f 64 65 20 69 66 20 74 68 65 sing code if the
15d0: 79 20 77 69 73 68 2e 0a 0a 7e 20 43 6f 70 79 72 y wish...~ Copyr
15e0: 69 67 68 74 0a 0a 54 68 69 73 20 64 6f 63 75 6d ight..This docum
15f0: 65 6e 74 20 68 61 73 20 62 65 65 6e 20 70 6c 61 ent has been pla
1600: 63 65 64 20 69 6e 20 74 68 65 20 70 75 62 6c 69 ced in the publi
1610: 63 20 64 6f 6d 61 69 6e 2e 0a c domain..