Blob Blame History Raw
# $XConsortium: TextField1.scr /main/5 1995/07/17 20:42:45 drk $
# 
# Motif
#
# Copyright (c) 1987-2012, The Open Group. All rights reserved.
#
# These libraries and programs are free software; you can
# redistribute them and/or modify them under the terms of the GNU
# Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# These libraries and programs are distributed in the hope that
# they will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with these librararies and programs; if not, write
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301 USA
# 
# 
# HISTORY
# 

WindowRaise Shell1
#  @) A client with a list of functions, control panel and TextField widget to 
#  be acted upon should appear.
#  #) Select the XmTextFieldGetEditable() function from the Functions List by
#  clicking MB1 on it.
#  Click on the Call Function PushButton.
#  The current editing status of the Action TextField widget will be shown in
#  Status/Input widget.  The status will be True.  Confirm this by clicking MB1
#  in the Action TextField and deleting a few characters.
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText
LocatePointer TextF1 RTextChar 10
ClickMB Btn1
ClickKey KBackSpace
ClickKey KBackSpace
CompareVisual TextF1

#  #) Select the XmTextFieldSetEditable() function.  Set the True/False Arg
#  ToggleButton to False.  Click on the Call Function PushButton.
#  The Action TextField widget's editable property will be toggled to False.
#  Select XmTextFieldGetEditable() function and click Call Function PushButton
#  again.  It should now show a value of False in the Status/Input widget.
#  Also, now try deleting some characters from the Action TextField widget.
LocatePointer List1 RListItem 1
ClickMB Btn1
LocatePointer ToggleB
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
LocatePointer TextF1 RTextChar 10
ClickMB Btn1
ClickKey KBackSpace
ClickKey KBackSpace
CompareVisual TextF1

#  #) Make the Action TextField widget editable again by selecting
#  XmTextFieldSetEditable, setting the True/False Arg to True and clicking on
#  Call Function.
LocatePointer List1 RListItem 1
ClickMB Btn1
LocatePointer ToggleB
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1

#  C)
Continue
WindowRaise Shell1

#  #) Select the XmTextFieldGetMaxLength() function and call it.
#  The value 27 will be reported in the Status widget.
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  #) Select the XmTextFieldSetMaxLength() function from the list.
#  Set the Numerical Arg 1 Scale to 30.  Click the Call Function PushButton.
#  Now select the XmTextFieldGetMaxLength() function.  The Status widget should 
#  read 30.
#  You should be able to add text to the Action
#  TextField widget until it's length is 30.
LocatePointer List1 RListItem 1
ClickMB Btn1
LocatePointer Scale1 RScaleSlider
DragSliderValue Right 30
LocatePointer ApplyB
ClickMB Btn1
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText
LocatePointer TextF1 RTextChar 20
ClickMB Btn1
InputString "New text"
CompareVisual TextF1

#  #) Select the XmTextFieldGetLastPosition() function and call it.  It should
#  read 30.  Now delete a few characters from Action TextField and click Call
#  Function again.  It will now read a few less than 30.
LocatePointer List1 RListItem 2
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText
LocatePointer TextF1 RTextChar 10
ClickMB Btn1
ClickKey KBackSpace
ClickKey KBackSpace
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  C)
Continue
WindowRaise Shell1

#  #) Select XmTextFieldSetInsertionPosition() from the Functions List.  Set the
#  Numerical Arg 1 Scale to 3.  Click the Call Function PushButton.  The
#  caret cursor in the Action TextField should move between the 'i' and 's' in
#  'This' (assuming that part of the text is still intact).
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer Scale1 RScaleSlider
DragSliderValue Left 3
LocatePointer ApplyB
ClickMB Btn1
CompareVisual TextF1

#  C)
Continue
WindowRaise Shell1

#  #) Select and call the XmTextFieldGetBaseline() function.  It should read
#  something near 20 depending on the metrics of the 'variable' font in use.
LocatePointer List1 RListItem 0
ClickMB Btn1
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  #) Select the XmTextFieldXYToPos() function.  Set the Num Arg 1 Scale to 14
#  and the Num Arg 2 Scale to 18.  Click the Call Function PushButton.
#  The Status/Input widget should read "Position = 1".  (The Num Arg 1
#  corresponds to the x argument and Num Arg 2 to the y argument.)
LocatePointer List1 RListItem 1
ClickMB Btn1
LocatePointer Scale1 RScaleSlider
DragSliderValue Right 14
LocatePointer Scale2 RScaleSlider
DragSliderValue Right 18
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  #) Set the Num Arg 2 Scale to a number about 4 larger than the value
#  returned by the earlier call to XmTextFieldGetBaseline() (i.e. 24-26).
#  Click Call Function.  The Status widget should read the same as it
#  did for the first call.  The Y value is unused for a TextField widget.
LocatePointer Scale2 RScaleSlider
DragSliderValue Right 25
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  #) Select the XmTextFieldPosToXY() function and set the Num Arg 1 Scale to 2.
#  Click the Call Function PushButton.  The Status widget should read something
#  like "x = 24, y = 20" (this will vary depending on the font metrics and what
#  the second character in the Action TextField widget is).
LocatePointer List1 RListItem 2
ClickMB Btn1
LocatePointer Scale1 RScaleSlider
DragSliderValue Left 2
LocatePointer ApplyB
ClickMB Btn1
CompareVisual StatText

#  E)
Exit