TextFXYPos1.src 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
  2. XCOMM $XConsortium: TextFXYPos1.src /main/3 1996/04/23 20:19:01 drk $
  3. XCOMM #########################################################################
  4. XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
  5. XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
  6. XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  7. XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  8. XCOMM Novell, Inc.
  9. XCOMM #########################################################################
  10. XCOMM
  11. XCOMM This sample shell script verifies that the XmTextFieldPosToXY command
  12. XCOMM functions correctly.
  13. XCOMM
  14. XCOMM Pushbutton Callback: exercise the Text functions
  15. RunTests()
  16. {
  17. XCOMM This position should not be visible
  18. if XmTextFieldPosToXY $TEXT 90 X Y; then
  19. echo "Text position 90 is at point ("$X","$Y")"
  20. else
  21. echo "Text position 90 is not currently visible"
  22. fi
  23. XCOMM This position should be visible
  24. if XmTextFieldPosToXY $TEXT 3 X Y; then
  25. echo "Text position 3 is at point ("$X","$Y")"
  26. else
  27. echo "Text position 3 is not currently visible"
  28. fi
  29. XmTextFieldXYToPos POS $TEXT $X $Y
  30. echo "At point ("$X","$Y") is character position "$POS
  31. }
  32. XCOMM ###################### Create the Main UI ###############################
  33. XtInitialize TOPLEVEL textFXYPos1 TextFXYPos1 "$0" "$@"
  34. XtSetValues $TOPLEVEL allowShellResize:True
  35. XmCreateTextField TEXT $TOPLEVEL text \
  36. columns:20 \
  37. value:"line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8"
  38. XtManageChild $TEXT
  39. XtRealizeWidget $TOPLEVEL
  40. XtCreateApplicationShell TOPLEVEL2 textFXYPos1a TopLevelShell
  41. XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
  42. orientation:HORIZONTAL \
  43. numColumns:2 \
  44. packing:PACK_COLUMN
  45. XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
  46. labelString:"Run XY Position Tests"
  47. XtAddCallback $PB1 activateCallback "RunTests"
  48. XtRealizeWidget $TOPLEVEL2
  49. XtMainLoop