Tracker: Patches

7 TIP #324: standard font selection dialog - ID: 1477426
Last Update: Settings changed ( patthoyts )


This patch implements a new standard dialog box as a
new command: tk_chooseFont

There is a Tk-only implementation and a Win32
implementation. The Mac implementation is missing :-(

The Win32 implementation uses the Win32 API function
ChooseFont.

Input parameters: none at this time

Output parameters: Font description as a list "family
size ?style...?"

style is bold, italic

The label description of the generic Tk implementation
is currently in German but stored in a array inside
tk_choosefont.

The Win32 implementation is build with the Borland Free
Command Line Tools

Greetings from Leipzig
G"oran


ghanke ( ghanke ) - 2006-04-26 22:55:15 PDT

7

Closed

Fixed

Daniel A. Steffen

33. Generic Dialog Support

TIP Implementation

Public


Comments ( 19 )

Date: 2010-01-05 05:48:40 PST
Sender: patthoyts

The scripted font dialog does close when the parent is destroyed on linux.
The other issues can be raised as bugs at some point if they annoy people.
Its just hidden in here.


Date: 2008-12-17 13:50:20 PST
Sender: dkf

Dropping prio; not a release-blocker now


Date: 2008-12-09 21:13:58 PST
Sender: das

leaving open as a reminder to fix a number of small issues with the
pure-tcl implementation:
- [tk choosefont configure] option changes ineffective once dialog has been
shown (except for -font)
- [tk choosefont configure] option querying fails with 'value for "-xxx"
missing'
- font dialog does not close when parent window is destroyed


Date: 2008-12-09 21:05:02 PST
Sender: das

committed attached updated patch to HEAD

adds docs & demos and other minor changes (file renaming for consistency,
deal with parent window destruction in macosx code) and removes [tk]
conversion to ensemble (committed separately)
c.f. github for details
http://github.com/das/tcltk/commits/fontchooser
File Added: tip324-081210.diff


Date: 2008-12-01 11:03:19 PST
Sender: das

TIP now updated to match this implementation

updated patch with minor changes attached, c.f. github for details
http://github.com/das/tcltk/commits/fontchooser

File Added: tip324-081201.diff


Date: 2008-11-28 15:06:58 PST
Sender: das

updated to apply cleanly to HEAD
File Added: tip324-081129.diff


Date: 2008-11-28 10:09:44 PST
Sender: das

ack, obviously meant to say:
'that I have _not_ been able to test'


Date: 2008-11-28 10:08:52 PST
Sender: das

note that the tip324-081128 patch makes minor changes to the windows code
that I have been able to test, so somebody needs to verify that the patch
still builds & works correctly on windows.


Date: 2008-11-28 09:51:56 PST
Sender: das

attached updated patch that:
- integrates Adrian Robert's changes posted to tcl-core recently (with a
rewrite of the TkMacOSXProcessFontEvent() changes that has some additional
fixes)
- adds a virtual event sent when the chosen font changes (i.e. when the
-cmd callback is called),
- turns [tk] into an ensemble
- renames [tk::choosefont] to [tk fontchooser] (and similarly for all
related symbols)

for full history, see http://github.com/das/tcltk/commits/fontchooser
note that patch needs to be applied with -p1

TIP update to match this patch will follow shortly


File Added: tip324-081128.diff


Date: 2008-09-04 00:56:40 PDT
Sender: dkf


You access the pure Tcl version using [tk_chooseFont] (or whatever the TIP
says) on the correct platform. The manner in which the dialog is
implemented (C code, Tcl script, whatever) is not defined in the spec: RTFS
if you want to know. :-p



Date: 2008-09-03 07:37:21 PDT
Sender: wordtech


I tested the OS X version with DAS's patch against the documentation
outlined at http://www.tcl.tk/cgi-bin/tct/tip/324:

tk::choosefont configure -parent: returns "."--not sure this is relevant on
the Mac because it's a native system dialog.
tk::choosefont configure -title: Title is hard-coded in dialog.
tk::choosefont configure -font: Running this command in the console changed
the selected font in the system dialog to the font specified by
"configure", but the console display did not reflect the new font until I
clicked on the font dialog. Not sure if this is a problem or not, but I
wanted to document the behavior.
tk::choosefont configure -visible: works as expected.
tk::choosefont hide and tk::choosefont show: works as expected.

tk::choosefont configure -command: This is unclear to me: do individual
developers need to worry about this or is it handled by the dialog? I'm
wondering because this seems to be where a developer would add an
additional command binding, i.e. writing the chosen font to a preferences
file, etc. Further explanation of this would be helpful.

Also, how does one access the pure-Tcl/script version of this dialog?
That's not clear from the documentation.


Date: 2008-06-18 17:26:41 PDT
Sender: das


updated patch attached with aqua implementation added.
File Added: tk_tip213-080619.diff


Date: 2008-06-01 11:46:57 PDT
Sender: patthoyts


Updated the patch once more. This now implements introspection of the
configuration options and adds a read-only -visible option which is needed
for platforms using a non-modal dialog. I have also added a virtual
<<TkChoosefontVisibility>> event that is sent to the parent window when the
visibility of the dialog changes.
Implementations in pure-tcl and native for Windows.
File Added: tk_chooseFont-20080516.patch


Date: 2008-05-10 16:53:22 PDT
Sender: patthoyts


New patch that implements both the script and Win32 versions as a
tk::choosefont ensemble with configure, show and hide sub-commands. This
has an example Font menu on the console which works fine in windows and
should work as expected on MacOSX too (where Cmd-T should toggle the
visibility of the dialog).
The API changes are in response to tcl-core input from the MacOSX people.
File Added: tk_chooseFont-20080511.patch


Date: 2008-04-18 03:44:24 PDT
Sender: patthoyts


Another patch update. This has more tests and now uses Keith Vetter's
script implementation with suitable updates for scripting and key
navigation.
File Added: tk_chooseFont-20080418.patch


Date: 2008-04-14 17:19:39 PDT
Sender: patthoyts


Updated the TIP and the sample implementation to permit MacOSX style usage.
The script implementation is my ttk version of dkf's dialog but Keith
Vetter has provided another that closely follows the Windows font chooser
that possibly the unix people may prefer.
File Added: tk_chooseFont-20080415.patch


Date: 2008-04-02 07:48:25 PDT
Sender: patthoyts


I've added a patch against 8.6 that merges the tkchat choosefont code for
windows into a tk_chooseFont command. For platforms that don't implement a
C tk_chooseFont tk.tcl will call to tk::choosefont::choosefont which is a
rewrite of dkf's fontSel dialog code but using ttk widgets. This is in
library/fontdlg.tcl

The interface to tk_chooseFont is close to that in the tip except for using
-apply instead of -updatefont as all the currently extant implementations
that I know of are using -apply.
A Mac implementation is welcome but I'll not be doing it.
File Added: tk_chooseFont.patch


Date: 2006-11-30 07:20:31 PST
Sender: patthoyts


I think that how mac users expect to see this work is pretty much
irrelevant. At the moment they don't get anything and neither do windows
and X users. We can arrange to have something done correctly for win32 and
something nice for X users and leave the Mac people with something that at
least lets them choose a font using a dialog. Once some enterprising mac
person sorts out how to do it for that platform then great.
In the meantime I have a couple of critcl units that provide a Win32 and a
Gtk standard font dialog and the package degrades to use DKFs tcl font
dialog. Currently this stuff is in the tkchat application.


Date: 2006-04-27 01:38:28 PDT
Sender: dkf

Logged In: YES
user_id=79902

The key problem with doing this sort of thing is that Win
users expect font dialogs to behave one way (modal, with OK
button, etc.) and Mac users expect font dialogs to behave
another (non-modal, with main menu item to show/hide the
dialog).

Resolving these differences is tricky. :-(

(TIP#213 http://tip.tcl.tk/213 is related, so classifying as
a TIP impl...)


Attached Files ( 3 )

Filename Description Download
tk_tip213-080619.diff Download
tk_chooseFont-20080516.patch updated TIP213 implementation (unix line endings, use -p1) Download
tip324-081210.diff final TIP324 implementation Download

Changes ( 35 )

Field Old Value Date By
close_date - 2010-01-05 05:48:41 PST patthoyts
status_id Open 2010-01-05 05:48:41 PST patthoyts
allow_comments 1 2010-01-05 05:48:41 PST patthoyts
priority 9 2008-12-17 13:50:20 PST dkf
File Deleted 303633: 2008-12-09 21:05:02 PST das
assigned_to patthoyts 2008-12-09 21:05:02 PST das
resolution_id None 2008-12-09 21:05:02 PST das
File Added 304765: tip324-081210.diff 2008-12-09 21:05:02 PST das
File Deleted 303378: 2008-12-01 11:03:19 PST das
File Added 303633: tip324-081201.diff 2008-12-01 11:03:19 PST das
File Added 303378: tip324-081129.diff 2008-11-28 15:08:01 PST das
File Deleted 303377: 2008-11-28 15:08:01 PST das
File Added 303377: tip324-081129.diff 2008-11-28 15:06:58 PST das
File Deleted 303352: 2008-11-28 15:06:58 PST das
File Added 303352: tip324-081128.diff 2008-11-28 09:51:56 PST das
summary TIP #213: standard font selection dialog 2008-11-28 09:51:56 PST das
File Added 281800: tk_tip213-080619.diff 2008-06-18 17:26:41 PDT das
File Deleted 175930: 2008-06-01 11:46:58 PDT patthoyts
File Deleted 277430: 2008-06-01 11:46:58 PDT patthoyts
File Deleted 275040: 2008-06-01 11:46:58 PDT patthoyts
File Deleted 274563: 2008-06-01 11:46:58 PDT patthoyts
File Deleted 272972: 2008-06-01 11:46:58 PDT patthoyts
File Deleted 272897: 2008-06-01 11:46:58 PDT patthoyts
priority 8 2008-06-01 11:46:57 PDT patthoyts
File Added 279791: tk_chooseFont-20080516.patch 2008-06-01 11:46:57 PDT patthoyts
summary tk_chooseFont Dialogbox (Win32, generic) 2008-05-10 16:53:22 PDT patthoyts
assigned_to dkf 2008-05-10 16:53:22 PDT patthoyts
File Added 277430: tk_chooseFont-20080511.patch 2008-05-10 16:53:21 PDT patthoyts
File Added 275040: tk_chooseFont-20080418.patch 2008-04-18 03:44:24 PDT patthoyts
File Added 274563: tk_chooseFont-20080415.patch 2008-04-14 17:19:39 PDT patthoyts
File Added 272972: tk_chooseFont-20080403.patch 2008-04-02 16:28:43 PDT patthoyts
priority 5 2008-04-02 07:48:26 PDT patthoyts
File Added 272897: tk_chooseFont.patch 2008-04-02 07:48:25 PDT patthoyts
artifact_group_id None 2006-04-27 01:38:28 PDT dkf
File Added 175930: tk_chooseFont.zip 2006-04-26 22:56:58 PDT ghanke