title: How can I find out if a Tcl_Obj is a certain kind of ttk:: entity, such as ttk:entry?
body: <p>I am working with a legacy (Desktop-style, as they're now known) Windows application built mostly in C and C++. When this application is running on a touchscreen Windows laptop, I need to automatically show the touch keyboard when the user taps inside an entry box on a dialog screen. This behavior is very common, and as far as I can tell, Microsoft <em>disabled</em> this formerly automatic behavior in Windows 8/8.1, and will be re-enabling it in Windows 10.</p>
  
  <p>So... I can programmatically show the touch keyboard, that part is solved. What I'm trying to do now is catch when a ttk::entry widget receives focus and then activate the keyboard. The closest I've come is inside tk8.5.9/generic/tkFocus.c. There is a method called Tk_FocusObjCmd:</p>
  
  <pre><code> /*
   *--------------------------------------------------------------
   *
   * Tk_FocusObjCmd --
   *
   *  This function is invoked to process the "focus" Tcl command. See the
   *  user documentation for details on what it does.
   *
   * Results:
   *  A standard Tcl result.
   *
   * Side effects:
   *  See the user documentation.
   *
   *--------------------------------------------------------------
   */
  
  int
  Tk_FocusObjCmd(
      ClientData clientData,  /* Main window associated with interpreter. */
      Tcl_Interp *interp,     /* Current interpreter. */
      int objc,           /* Number of arguments. */
      Tcl_Obj *CONST objv[])  /* Argument objects. */
  {
  </code></pre>
  
  <p>This method is given, among other things, an array of Tcl_Obj objects. What I'm trying to do is find out if the one being acted on is of a certain type, such as ttk::entry. If it is, I will launch the touch keyboard. I've tried using object->typePtr->name, but that doesn't give me what I'd expected, and sometimes it crashes (haven't figured out why yet):</p>
  
  <pre><code>char *objectType = objv[1]-&gt;typePtr-&gt;name;
  
  if (objectType)
  {
      printf("Object Type: %s\n", objectType); // don't do this, it breaks sometimes.
  }
  </code></pre>
  
  <p>This is where I'm stuck. I would greatly appreciate any insight to get me in the right direction.</p>