winfo.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:14k
- '"
- '" Copyright (c) 1990-1994 The Regents of the University of California.
- '" Copyright (c) 1994-1997 Sun Microsystems, Inc.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: winfo.n,v 1.3.2.1 2004/10/28 12:25:22 dkf Exp $
- '"
- .so man.macros
- .TH winfo n 4.3 Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- winfo - Return window-related information
- .SH SYNOPSIS
- fBwinfofR fIoption fR?fIarg arg ...fR?
- .BE
- .SH DESCRIPTION
- .PP
- The fBwinfofR command is used to retrieve information about windows
- managed by Tk. It can take any of a number of different forms,
- depending on the fIoptionfR argument. The legal forms are:
- .TP
- fBwinfo atom fR?fB-displayof fIwindowfR? fInamefR
- Returns a decimal string giving the integer identifier for the
- atom whose name is fInamefR. If no atom exists with the name
- fInamefR then a new one is created.
- If the fB-displayoffR option is given then the atom is looked
- up on the display of fIwindowfR; otherwise it is looked up on
- the display of the application's main window.
- .TP
- fBwinfo atomname fR?fB-displayof fIwindowfR? fIidfR
- Returns the textual name for the atom whose integer identifier is
- fIidfR.
- If the fB-displayoffR option is given then the identifier is looked
- up on the display of fIwindowfR; otherwise it is looked up on
- the display of the application's main window.
- This command is the inverse of the fBwinfo atomfR command.
- It generates an error if no such atom exists.
- .TP
- fBwinfo cells fIwindowfR
- Returns a decimal string giving the number of cells in the
- color map for fIwindowfR.
- .TP
- fBwinfo children fIwindowfR
- Returns a list containing the path names of all the children
- of fIwindowfR. Top-level windows are returned as children
- of their logical parents. The list is in stacking order, with
- the lowest window first, except for Top-level windows which
- are not returned in stacking order. Use the fBwm stackorderfR
- command to query the stacking order of Top-level windows.
- .TP
- fBwinfo class fIwindowfR
- Returns the class name for fIwindowfR.
- .TP
- fBwinfo colormapfull fIwindowfR
- Returns 1 if the colormap for fIwindowfR is known to be full, 0
- otherwise. The colormap for a window is ``known'' to be full if the last
- attempt to allocate a new color on that window failed and this
- application hasn't freed any colors in the colormap since the
- failed allocation.
- .TP
- fBwinfo containing fR?fB-displayof fIwindowfR? fIrootX rootYfR
- Returns the path name for the window containing the point given
- by fIrootXfR and fIrootYfR.
- fIRootXfR and fIrootYfR are specified in screen units (i.e.
- any form acceptable to fBTk_GetPixelsfR) in the coordinate
- system of the root window (if a virtual-root window manager is in
- use then the coordinate system of the virtual root window is used).
- If the fB-displayoffR option is given then the coordinates refer
- to the screen containing fIwindowfR; otherwise they refer to the
- screen of the application's main window.
- If no window in this application contains the point then an empty
- string is returned.
- In selecting the containing window, children are given higher priority
- than parents and among siblings the highest one in the stacking order is
- chosen.
- .TP
- fBwinfo depth fIwindowfR
- Returns a decimal string giving the depth of fIwindowfR (number
- of bits per pixel).
- .TP
- fBwinfo exists fIwindowfR
- Returns 1 if there exists a window named fIwindowfR, 0 if no such
- window exists.
- .TP
- fBwinfo fpixels fIwindowfR fInumberfR
- Returns a floating-point value giving the number of pixels
- in fIwindowfR corresponding to the distance given by fInumberfR.
- fINumberfR may be specified in any of the forms acceptable
- to fBTk_GetScreenMMfR, such as ``2.0c'' or ``1i''.
- The return value may be fractional; for an integer value, use
- fBwinfo pixelsfR.
- .TP
- fBwinfo geometry fIwindowfR
- Returns the geometry for fIwindowfR, in the form
- fIwidthfBxfIheightfB+fIxfB+fIyfR. All dimensions are
- in pixels.
- .TP
- fBwinfo height fIwindowfR
- Returns a decimal string giving fIwindowfR's height in pixels.
- When a window is first created its height will be 1 pixel; the
- height will eventually be changed by a geometry manager to fulfill
- the window's needs.
- If you need the true height immediately after creating a widget,
- invoke fBupdatefR to force the geometry manager to arrange it,
- or use fBwinfo reqheightfR to get the window's requested height
- instead of its actual height.
- .TP
- fBwinfo id fIwindowfR
- .VS
- Returns a hexadecimal string giving a low-level platform-specific
- identifier for fIwindowfR. On Unix platforms, this is the X
- window identifier. Under Windows, this is the Windows
- HWND. On the Macintosh the value has no meaning outside Tk.
- .VE
- .TP
- fBwinfo interps fR?fB-displayof fIwindowfR?
- Returns a list whose members are the names of all Tcl interpreters
- (e.g. all Tk-based applications) currently registered for a particular display.
- If the fB-displayoffR option is given then the return value refers
- to the display of fIwindowfR; otherwise it refers to
- the display of the application's main window.
- .TP
- fBwinfo ismapped fIwindowfR
- Returns fB1fR if fIwindowfR is currently mapped, fB0fR otherwise.
- .TP
- fBwinfo manager fIwindowfR
- Returns the name of the geometry manager currently
- responsible for fIwindowfR, or an empty string if fIwindowfR
- isn't managed by any geometry manager.
- The name is usually the name of the Tcl command for the geometry
- manager, such as fBpackfR or fBplacefR.
- If the geometry manager is a widget, such as canvases or text, the
- name is the widget's class command, such as fBcanvasfR.
- .TP
- fBwinfo name fIwindowfR
- Returns fIwindowfR's name (i.e. its name within its parent, as opposed
- to its full path name).
- The command fBwinfo name .fR will return the name of the application.
- .TP
- fBwinfo parent fIwindowfR
- Returns the path name of fIwindowfR's parent, or an empty string
- if fIwindowfR is the main window of the application.
- .TP
- fBwinfo pathname fR?fB-displayof fIwindowfR? fIidfR
- Returns the path name of the window whose X identifier is fIidfR.
- fIIdfR must be a decimal, hexadecimal, or octal integer and must
- correspond to a window in the invoking application.
- If the fB-displayoffR option is given then the identifier is looked
- up on the display of fIwindowfR; otherwise it is looked up on
- the display of the application's main window.
- .TP
- fBwinfo pixels fIwindowfR fInumberfR
- Returns the number of pixels in fIwindowfR corresponding
- to the distance given by fInumberfR.
- fINumberfR may be specified in any of the forms acceptable
- to fBTk_GetPixelsfR, such as ``2.0c'' or ``1i''.
- The result is rounded to the nearest integer value; for a
- fractional result, use fBwinfo fpixelsfR.
- .TP
- fBwinfo pointerx fIwindowfR
- If the mouse pointer is on the same screen as fIwindowfR, returns the
- pointer's x coordinate, measured in pixels in the screen's root window.
- If a virtual root window is in use on the screen, the position is
- measured in the virtual root.
- If the mouse pointer isn't on the same screen as fIwindowfR then
- -1 is returned.
- .TP
- fBwinfo pointerxy fIwindowfR
- If the mouse pointer is on the same screen as fIwindowfR, returns a list
- with two elements, which are the pointer's x and y coordinates measured
- in pixels in the screen's root window.
- If a virtual root window is in use on the screen, the position
- is computed in the virtual root.
- If the mouse pointer isn't on the same screen as fIwindowfR then
- both of the returned coordinates are -1.
- .TP
- fBwinfo pointery fIwindowfR
- If the mouse pointer is on the same screen as fIwindowfR, returns the
- pointer's y coordinate, measured in pixels in the screen's root window.
- If a virtual root window is in use on the screen, the position
- is computed in the virtual root.
- If the mouse pointer isn't on the same screen as fIwindowfR then
- -1 is returned.
- .TP
- fBwinfo reqheight fIwindowfR
- Returns a decimal string giving fIwindowfR's requested height,
- in pixels. This is the value used by fIwindowfR's geometry
- manager to compute its geometry.
- .TP
- fBwinfo reqwidth fIwindowfR
- Returns a decimal string giving fIwindowfR's requested width,
- in pixels. This is the value used by fIwindowfR's geometry
- manager to compute its geometry.
- .TP
- fBwinfo rgb fIwindow colorfR
- Returns a list containing three decimal values in the range 0 to
- 65535, which are the
- red, green, and blue intensities that correspond to fIcolorfR in
- the window given by fIwindowfR. fIColorfR
- may be specified in any of the forms acceptable for a color
- option.
- .TP
- fBwinfo rootx fIwindowfR
- Returns a decimal string giving the x-coordinate, in the root
- window of the screen, of the
- upper-left corner of fIwindowfR's border (or fIwindowfR if it
- has no border).
- .TP
- fBwinfo rooty fIwindowfR
- Returns a decimal string giving the y-coordinate, in the root
- window of the screen, of the
- upper-left corner of fIwindowfR's border (or fIwindowfR if it
- has no border).
- .TP
- fBwinfo screen fIwindowfR
- Returns the name of the screen associated with fIwindowfR, in
- the form fIdisplayNamefR.fIscreenIndexfR.
- .TP
- fBwinfo screencells fIwindowfR
- Returns a decimal string giving the number of cells in the default
- color map for fIwindowfR's screen.
- .TP
- fBwinfo screendepth fIwindowfR
- Returns a decimal string giving the depth of the root window
- of fIwindowfR's screen (number of bits per pixel).
- .TP
- fBwinfo screenheight fIwindowfR
- Returns a decimal string giving the height of fIwindowfR's screen,
- in pixels.
- .TP
- fBwinfo screenmmheight fIwindowfR
- Returns a decimal string giving the height of fIwindowfR's screen,
- in millimeters.
- .TP
- fBwinfo screenmmwidth fIwindowfR
- Returns a decimal string giving the width of fIwindowfR's screen,
- in millimeters.
- .TP
- fBwinfo screenvisual fIwindowfR
- Returns one of the following strings to indicate the default visual
- class for fIwindowfR's screen: fBdirectcolorfR, fBgrayscalefR,
- fBpseudocolorfR, fBstaticcolorfR, fBstaticgrayfR, or
- fBtruecolorfR.
- .TP
- fBwinfo screenwidth fIwindowfR
- Returns a decimal string giving the width of fIwindowfR's screen,
- in pixels.
- .TP
- fBwinfo server fIwindowfR
- Returns a string containing information about the server for
- fIwindowfR's display. The exact format of this string may vary
- from platform to platform. For X servers the string
- has the form ``fBXfImajorfBRfIminor vendor vendorVersionfR''
- where fImajorfR and fIminorfR are the version and revision
- numbers provided by the server (e.g., fBX11R5fR), fIvendorfR
- is the name of the vendor for the server, and fIvendorReleasefR
- is an integer release number provided by the server.
- .TP
- fBwinfo toplevel fIwindowfR
- Returns the path name of the top-level window containing fIwindowfR.
- .TP
- fBwinfo viewable fIwindowfR
- Returns 1 if fIwindowfR and all of its ancestors up through the
- nearest toplevel window are mapped. Returns 0 if any of these
- windows are not mapped.
- .TP
- fBwinfo visual fIwindowfR
- Returns one of the following strings to indicate the visual
- class for fIwindowfR: fBdirectcolorfR, fBgrayscalefR,
- fBpseudocolorfR, fBstaticcolorfR, fBstaticgrayfR, or
- fBtruecolorfR.
- .TP
- fBwinfo visualid fIwindowfR
- Returns the X identifier for the visual for fIwindowfR.
- .TP
- fBwinfo visualsavailable fIwindowfR ?fBincludeidsfR?
- Returns a list whose elements describe the visuals available for
- fIwindowfR's screen.
- Each element consists of a visual class followed by an integer depth.
- The class has the same form as returned by fBwinfo visualfR.
- The depth gives the number of bits per pixel in the visual.
- In addition, if the fBincludeidsfR argument is provided, then the
- depth is followed by the X identifier for the visual.
- .TP
- fBwinfo vrootheight fIwindowfR
- Returns the height of the virtual root window associated with fIwindowfR
- if there is one; otherwise returns the height of fIwindowfR's screen.
- .TP
- fBwinfo vrootwidth fIwindowfR
- Returns the width of the virtual root window associated with fIwindowfR
- if there is one; otherwise returns the width of fIwindowfR's screen.
- .TP
- fBwinfo vrootx fIwindowfR
- Returns the x-offset of the virtual root window associated with fIwindowfR,
- relative to the root window of its screen.
- This is normally either zero or negative.
- Returns 0 if there is no virtual root window for fIwindowfR.
- .TP
- fBwinfo vrooty fIwindowfR
- Returns the y-offset of the virtual root window associated with fIwindowfR,
- relative to the root window of its screen.
- This is normally either zero or negative.
- Returns 0 if there is no virtual root window for fIwindowfR.
- .TP
- fBwinfo width fIwindowfR
- Returns a decimal string giving fIwindowfR's width in pixels.
- When a window is first created its width will be 1 pixel; the
- width will eventually be changed by a geometry manager to fulfill
- the window's needs.
- If you need the true width immediately after creating a widget,
- invoke fBupdatefR to force the geometry manager to arrange it,
- or use fBwinfo reqwidthfR to get the window's requested width
- instead of its actual width.
- .TP
- fBwinfo x fIwindowfR
- Returns a decimal string giving the x-coordinate, in fIwindowfR's
- parent, of the
- upper-left corner of fIwindowfR's border (or fIwindowfR if it
- has no border).
- .TP
- fBwinfo y fIwindowfR
- Returns a decimal string giving the y-coordinate, in fIwindowfR's
- parent, of the
- upper-left corner of fIwindowfR's border (or fIwindowfR if it
- has no border).
- .SH EXAMPLE
- Print where the mouse pointer is and what window it is currently over:
- .CS
- set x [fBwinfo pointerxfR .]
- set y [fBwinfo pointeryfR .]
- puts -nonewline "Mouse pointer at ($x,$y) which is "
- set win [fBwinfo containingfR $x $y]
- if {$win eq ""} {
- puts "over no window"
- } else {
- puts "over $win"
- }
- .CE
- .SH KEYWORDS
- atom, children, class, geometry, height, identifier, information, interpreters,
- mapped, parent, path name, screen, virtual root, width, window