TIP #96: Add [tk caret] Command and Tk_SetCaretPos API 
Author Message
 TIP #96: Add [tk caret] Command and Tk_SetCaretPos API

 Version:      $Revision: 1.1 $
 Author:       Jeff Hobbs <JeffH_at_ActiveState.com>
 State:        Draft
 Type:         Project
 Tcl-Version:  8.4
 Vote:         Pending
 Created:      Wednesday, 29 May 2002
 URL:           http://www.*-*-*.com/
 WebEdit:       http://www.*-*-*.com/



 This TIP proposes to add a [tk caret] command and [Tk_SetCaretPos] C
 API to manage _carets_ in Tk. _caret_ is the term for where text of
 graphics will be inserted. It is necessary for correct accessibility
 functionality (to know where to shift focus), and for location the IME
 or XIM input box to handle complex character input (e.g. Asian
 character sets).


 Tk has up until now not managed the caret within its windows. This has
 led to it being not Windows Accessibility certifiable. On Windows, this
 also cause the IME window to show in the top-left corner of the window
 (somewhat OK for entries, bad for text widgets). On X, this meant that
 Tk had to use the root-window style XIM input, which is a poor second
 to over-the-spot XIM input. Managing the caret corrects these problems.

 Exposing the functionality at the Tcl level allows extension writers to
 use the functionality without having to make Tk version API checks. A

      catch {tk caret $w -x $x -y $y}

 will suffice to work across versions.


      tk caret window ?-x xPos? ?-y yPos? ?-height height?
      void Tk_SetCaretPos (Tk_Window tkwin, int x, int y, int height)

 _-height_ specifies the height of the input line and is important
 because Windows and X interpret the x,y coordinates differently
 (top-left and bottom-left respectively), so it must be adjusted by
 height for X. If no height is specified, the height of the window
 passed in will be used.

 I chose to use the _-option value_ format because it allows for future
 extensibility. There are APIs to control the font and other aspects of
 the IME/XIM input window that appears, but management of these is not
 covered in this tip.


 The Tk_SetCaretPos implementation is currently in the core. It needs to
 be modified to move the caret information to be per display, instead of
 per process.

 File: _tk/mac/tkMacXStubs.c_

 File: _tk/win/tkWinX.c_

 File: _tk/unix/tkUnixKey.c_

 Function: _Tk_SetCaretPos_


 The current implementation at the C level was implemented with the
 assistance of Keiichi Takahashi (BitWalk), Koiichi Yamamoto, Moo Kim
 (NCR), and Mike Fabian (SuSE). It has been tested on Windows 98/2000/XP
 and SuSE 7.3 using kinput/canna2.


 This document has been placed in the public domain.


 TIP AutoGenerator - written by Donal K. Fellows

  Announcements archived at http://www.*-*-*.com/
  The primary Tcl/Tk archive is ftp://ftp.neosoft.com/pub/tcl/ ]]

Wed, 17 Nov 2004 05:28:55 GMT  
 [ 1 post ] 

 Relevant Pages 

1. TIP #49: I/O Subsystem: Add API Tcl_OutputBuffered(chan)

2. TIP #44: Move Tk's Private Commands and Variables into ::tk Namespace

3. TIP #214: Add New Object Introspection Command

4. TIP #208: Add a 'chan' Command

5. TIP #206: Add an [ftruncate] Command

6. TIP #181: Add a [namespace unknown] Command

7. TIP #153: Adding a [winfo tophierarchy] Command

8. TIP #123: Adding an Exponentiation Operator to the [expr] Command

9. TIP #106: Add encoding abilities to the DDE command

10. TIP #95: Add [wm attributes] Command

11. TIP #62: Add Support for Command Tracing

12. TIP #8: Add winico support to the wm command on windows


Powered by phpBB® Forum Software