Fonts and Text Attributes in .NET Access Denso QR Bar Code in .NET Fonts and Text Attributes

Fonts and Text Attributes use none none generation todraw none in none .NET Framework Chap.24 SetFont. Finally, Reset restores the font name to the match-all pattern. Example 24 12 The font selection procedures. proc DoFont { } { global font set font(current) {} foreach x $font(comps) { append font(current) -$font(cur,$x) } SetFont } proc SelectFont { list y } { # Extract a font name from the listbox global font set ix [$font(list) nearest $y] set font(current) [$font(list) get $ix] set parts [split $font(current) -] if {[llength $parts] < 14} { foreach x $font(comps) { set font(cur,$x) {} } } else { set i 1 foreach x $font(comps) { set value [lindex $parts $i] incr i set font(cur,$x) $value } } SetFont } proc SetFont {} { global font # Generate a regular expression from the font pattern regsub -all -- { nil } $font(current) {} font(current) regsub -all -- {\*} $font(current) {[^-]*} pattern for {set n 0} {$n < $font(N)} {incr n} { if [regexp -- $pattern $font(all,$n)] { $font(msg) config -font $font(current) \ -text $font(sampler) catch {$font(list) select clear \ [$font(list) curselection]} $font(list) select set $n $font(list) see $n return } } $font(msg) config -text $font(errormsg) } proc Reset {} { global font foreach x $font(comps) {. Created: March 1 none none 5, 1994 Font.fm3 Copyright Prentice Hall DRAFT: 1/13/95. A Font Selection Application set font(cur,$x) none for none * } DoFont Status "$font(num) fonts" } Reset This is what the interface looks like. . Created: March 1 5, 1994 Font.fm3 Copyright Prentice Hall DRAFT: 1/13/95. Fonts and Text Attributes Chap.24 Created: March 1 none for none 5, 1994 Font.fm3 Copyright Prentice Hall DRAFT: 1/13/95. Window Managers and Window Information 25 A window manager none none is a special application that can control the size and location of other applications windows. The wm command provides an interface to the window manager. The winfo command returns information about windows.

. anagement of top level windows is done by a distinguished application called the window manager. The window manager controls the position of toplevel windows, and it provides a way to resize windows, open and close them, and it implements a border and decorative title for windows. The window manager contributes to the general look and feel of the X display, but there is no requirement that the look and feel of the window manager be the same as that used in an application.

The wm command is used to interact with the window manager so that the application itself can control its size, position, and iconi ed state . If you need to ne tune your display you may need some detailed information about widgets. The winfo command returns all sorts of information about windows, including interior widgets, not just toplevel windows.

. The wm Command The wm command h as about 20 operations that interact with the window manager. The general form of the commands is:. wm operation win args In all cases the win argument must be for a toplevel window. Otherwise an error is raised. In many cases the operation either sets or queries a value.

If a new value is not speci ed, then the current settings are returned. For example,. Created: March 1 none none 5, 1994 Window.fm3 Copyright Prentice Hall DRAFT: 1/13/95. Window Managers and Window Information Chap.25 the rst command below returns the current window geometry and the next , command de nes a new geometry .. wm geometry . => 300x200+327+20 wm geometry . 400x200+0+0 The operations c an be grouped into four main categories. Size, placement and decoration of windows. Icons.

Long term session state. Miscellaneous. Size, placement, and decoration Perhaps the most commonly used wm operation is wm title that sets the title of the window.

The title appears in the title bar that the window manager places above your application s main window. The title may also appear in the icon for your window, unless you specify another name with wm iconname..

wm title . "My Application". The wm geometry command can be used to adjust the position or size of your main windows. A geometry speci cation has the general formWxH+X+Y, where W is the widget, H is the height, and X and Y specify the location of the upper-left corner of the window. The location +0+0 is the upper-left corner of the display.

You can specify a negative X or Y to position the bottom (right) side of the window relative to the bottom (right) side of the display. For example, +0-0 is the lower left corner, and -100-100 is offset from the lower-right corner by 100 pixels in the X and Y direction. If you do not specify a geometry, then the current geometry is returned.

A window can have a gridded geometry, which means that the geometry is in terms of some unit other than pixels. For example, the text and listbox widgets can set a grid based on the size of the characters they display. You can de ne a grid with the wm grid command, or you can use that command to nd out what the current grid size is.

The next example sets up gridded geometry for a canvas..
Copyright © . All rights reserved.