{"id":6325,"date":"2022-12-20T18:58:09","date_gmt":"2022-12-20T21:58:09","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/fontchooser-mann\/"},"modified":"2022-12-20T18:58:09","modified_gmt":"2022-12-20T21:58:09","slug":"fontchooser-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/fontchooser-mann\/","title":{"rendered":"fontchooser (mann)"},"content":{"rendered":"<h1 align=\"center\">fontchooser<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#CONFIGURATION OPTIONS\">CONFIGURATION OPTIONS<\/a><br \/> <a href=\"#VIRTUAL EVENTS\">VIRTUAL EVENTS<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#EXAMPLE\">EXAMPLE<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">fontchooser \u2212 control font selection dialog<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tk fontchooser configure<\/b> ?<i>\u2212option value \u2212option value &#8230;<\/i>?<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tk fontchooser show<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tk fontchooser hide<\/b> ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tk fontchooser<\/b> command controls the Tk font selection dialog. It uses the native platform font selection dialog where available, or a dialog implemented in Tcl otherwise.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Unlike most of the other Tk dialog commands, <b>tk fontchooser<\/b> does not return an immediate result, as on some platforms (Mac OS X) the standard font dialog is modeless while on others (Windows) it is modal. To accommodate this difference, all user interaction with the dialog will be communicated to the caller via callbacks or virtual events.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>tk fontchooser<\/b> command can have one of the following forms: <b><br \/> tk fontchooser configure<\/b> ?<i>\u2212option value \u2212option value &#8230;<\/i>?<\/p>\n<p style=\"margin-left:22%;\">Set or query one or more of the configurations options below (analogous to Tk widget configuration).<\/p>\n<p style=\"margin-left:11%;\"><b>tk fontchooser show<\/b><\/p>\n<p style=\"margin-left:22%;\">Show the font selection dialog. Depending on the platform, may return immediately or only once the dialog has been withdrawn.<\/p>\n<p style=\"margin-left:11%;\"><b>tk fontchooser hide<\/b><\/p>\n<p style=\"margin-left:22%;\">Hide the font selection dialog if it is visible and cause any pending <b>tk fontchooser show<\/b> command to return.<\/p>\n<h2>CONFIGURATION OPTIONS <a name=\"CONFIGURATION OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>\u2212parent<\/b><\/p>\n<p style=\"margin-left:22%;\">Specifies\/returns the logical parent window of the font selection dialog (similar to the <b>\u2212parent<\/b> option to other dialogs). The font selection dialog is hidden if it is visible when the parent window is destroyed.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212title<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Specifies\/returns the title of the dialog. Has no effect on platforms where the font selection dialog does not support titles.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"9%\">\n<p><b>\u2212font<\/b><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"78%\">\n<p>Specifies\/returns the font that is currently selected in the dialog if it is visible, or that will be initially selected when the dialog is shown (if supported by the platform). Can be set to the empty string to indicate that no font should be selected. Fonts can be specified in any form given by the &#8220;FONT DESCRIPTION&#8221; section in the <b>font<\/b> manual page.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><b>\u2212command<\/b><\/p>\n<p style=\"margin-left:22%;\">Specifies\/returns the command prefix to be called when a font selection has been made by the user. The command prefix is evaluated at the global level after having the specification of the selected font appended. On platforms where the font selection dialog offers the user control of further font attributes (such as color), additional key\/value pairs may be appended before evaluation. Can be set to the empty string to indicate that no callback should be invoked. Fonts are specified by a list of form [3] of the &#8220;FONT DESCRIPTION&#8221; section in the <b>font<\/b> manual page (i.e. a list of the form <i>{family size style ?style &#8230;?}<\/i>).<\/p>\n<p style=\"margin-left:11%;\"><b>\u2212visible<\/b><\/p>\n<p style=\"margin-left:22%;\">Read-only option that returns a boolean indicating whether the font selection dialog is currently visible. Attempting to set this option results in an error.<\/p>\n<h2>VIRTUAL EVENTS <a name=\"VIRTUAL EVENTS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><<TkFontchooserVisibility>><\/b><\/p>\n<p style=\"margin-left:22%;\">Sent to the dialog parent whenever the visibility of the font selection dialog changes, both as a result of user action (e.g. disposing of the dialog via OK\/Cancel button or close box) and of the <b>tk fontchooser show<\/b>\/<b>hide<\/b> commands being called. Binding scripts can determine the current visibility of the dialog by querying the <b>\u2212visible<\/b> configuration option.<\/p>\n<p style=\"margin-left:11%;\"><b><<TkFontchooserFontChanged>><\/b><\/p>\n<p style=\"margin-left:22%;\">Sent to the dialog parent whenever the font selection dialog is visible and the selected font changes, both as a result of user action and of the <b>\u2212font<\/b> configuration option being set. Binding scripts can determine the currently selected font by querying the <b>\u2212font<\/b> configuration option.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Callers should not expect a result from <b>tk fontchooser show<\/b> and may not assume that the dialog has been withdrawn or closed when the command returns. All user interaction with the dialog is communicated to the caller via the <b>\u2212command<\/b> callback and the <b><<TkFontchooser*>><\/b> virtual events. It is implementation dependent which exact user actions result in the callback being called resp. the virtual events being sent. Where an Apply or OK button is present in the dialog, that button will trigger the <b>\u2212command<\/b> callback and <b><<TkFontchooserFontChanged>><\/b> virtual event. On some implementations other user actions may also have that effect; on Mac OS X for instance, the standard font selection dialog immediately reflects all user choices to the caller.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the presence of multiple widgets intended to be influenced by the font selection dialog, care needs to be taken to correctly handle focus changes: the font selected in the dialog should always match the current font of the widget with the focus, and the <b>\u2212command<\/b> callback should only act on the widget with the focus. The recommended practice is to set font dialog <b>\u2212font<\/b> and <b>\u2212command<\/b> configuration options in per\u2212widget <b><FocusIn><\/b> handlers (and if necessary to unset them \u2212 i.e. set to the empty string \u2212 in corresponding <b><FocusOut><\/b> handlers). This is particularly important for implementers of library code using the font selection dialog, to avoid conflicting with application code that may also want to use the dialog.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Because the font selection dialog is application-global, in the presence of multiple interpreters calling <b>tk fontchooser<\/b>, only the <b>\u2212command<\/b> callback set by the interpreter that most recently called <b>tk fontchooser configure<\/b> or <b>tk fontchooser show<\/b> will be invoked in response to user action and only the <b>\u2212parent<\/b> set by that interpreter will receive <b><<TkFontchooser*>><\/b> virtual events.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The font dialog implementation may only store (and return) <b>font actual<\/b> data as the value of the <b>\u2212font<\/b> configuration option. This can be an issue when <b>\u2212font<\/b> is set to a named font, if that font is subsequently changed, the font dialog <b>\u2212font<\/b> option needs to be set again to ensure its selected font matches the new value of the named font.<\/p>\n<h2>EXAMPLE <a name=\"EXAMPLE\"><\/a> <\/h2>\n<p style=\"margin-left:22%; margin-top: 1em\">proc fontchooserDemo {} { <br \/> wm title . &#8220;Font Chooser Demo&#8221; <b><br \/> tk fontchooser configure<\/b> \u2212parent . <br \/> button .b \u2212command fontchooserToggle \u2212takefocus 0 <br \/> fontchooserVisibility .b <br \/> bind . <b><<TkFontchooserVisibility>><\/b>  <br \/> [list fontchooserVisibility .b] <br \/> foreach w {.t1 .t2} { <br \/> text $w \u2212width 20 \u2212height 4 \u2212borderwidth 1 \u2212relief solid <br \/> bind $w <FocusIn> [list fontchooserFocus $w] <br \/> $w insert end &#8220;Text Widget $w&#8221; <br \/> } <br \/> .t1 configure \u2212font {Courier 14} <br \/> .t2 configure \u2212font {Times 16} <br \/> pack .b .t1 .t2; focus .t1 <br \/> } <br \/> proc fontchooserToggle {} { <b><br \/> tk fontchooser<\/b> [expr { <br \/> [<b>tk fontchooser configure<\/b> \u2212visible] ? <br \/> &#8220;<b>hide<\/b>&#8221; : &#8220;<b>show<\/b>&#8220;}] <br \/> } <br \/> proc fontchooserVisibility {w} { <br \/> $w configure \u2212text [expr { <br \/> [<b>tk fontchooser configure<\/b> \u2212visible] ? <br \/> &#8220;Hide Font Dialog&#8221; : &#8220;Show Font Dialog&#8221;}] <br \/> } <br \/> proc fontchooserFocus {w} { <b><br \/> tk fontchooser configure<\/b> \u2212font [$w cget \u2212font]  <br \/> \u2212command [list fontchooserFontSelection $w] <br \/> } <br \/> proc fontchooserFontSelection {w font args} { <br \/> $w configure \u2212font [font actual $font] <br \/> } <br \/> fontchooserDemo<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">font(n), tk(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">dialog, font, font selection, font chooser, font panel<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  fontchooser \u2212 control font selection dialog <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2922,2635],"class_list":["post-6325","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-fontchooser","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6325"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6325\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}