Posted to tcl by kevin_walzer at Sun Jan 26 04:07:44 GMT 2025view raw

  1. /*
  2. *----------------------------------------------------------------------
  3. *
  4. * Tk_GetAccessibleDescription --
  5. *
  6. * This function reads a platform-neutral accessibility descrption for a
  7. * specific widget.
  8. *
  9. *
  10. * Results:
  11. * Assigns an accessibility description.
  12. *
  13. * Side effects:
  14. * None.
  15. *
  16. *----------------------------------------------------------------------
  17. */
  18.  
  19. int
  20. Tk_GetAccessibleDescription(
  21. TCL_UNUSED(void *),
  22. Tcl_Interp *ip, /* Current interpreter. */
  23. int objc, /* Number of arguments. */
  24. Tcl_Obj *const objv[]) /* Argument objects. */
  25. {
  26. if (objc < 2) {
  27. Tcl_WrongNumArgs(ip, 1, objv, "window?");
  28. return TCL_ERROR;
  29. }
  30.  
  31. Tk_Window win;
  32. Tcl_HashEntry *hPtr, *hPtr2;
  33.  
  34. Tcl_HashTable *AccessibleAttributes;
  35.  
  36. win = Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip));
  37. if (win == NULL) {
  38. return TCL_ERROR;
  39. }
  40.  
  41. /* Get accessible description for window. */
  42. hPtr=Tcl_FindHashEntry(TkAccessibilityObject, win);
  43. if (!hPtr) {
  44. Tcl_AppendResult(ip, "No table found. You must set the accessibility role first.", (char *) NULL);
  45. return TCL_ERROR;
  46. }
  47. AccessibleAttributes = Tcl_GetHashValue(hPtr);
  48. hPtr2=Tcl_FindHashEntry(AccessibleAttributes, "description");
  49. if (!hPtr2) {
  50. Tcl_AppendResult(ip, "No description found", (char *) NULL);
  51. return TCL_ERROR;
  52. }
  53.  
  54. Tcl_SetObjResult(ip, Tcl_GetHashValue(hPtr2));
  55. return TCL_OK;
  56. }
  57.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week