Entry Objects

Objects of type Entry are displayed as text entry boxes that can be edited by the user of the program. Entry objects support the generic graphics methods move(), draw(graphwin), undraw(), setFill(color), and clone(). The Entry specific methods are given below.

Entry(centerPoint, width)
Constructs an Entry having the given center point and width. The width is specified in number of characters of text that can be displayed.


Example: inputBox = Entry(Point(3,4), 5)

getAnchor()
Returns a clone of the point where the entry box is centered.


Example: centerPoint = inputBox.getAnchor()

getText()
Returns the string of text that is currently in the entry box.


Example: inputStr = inputBox.getText()

setText(string)
Sets the text in the entry box to the given string.


Example: inputBox.setText("32.0")

setFace(family)
Changes the font face to the given family. Possible values are "helvetica", "courier", "times roman", and "arial".


Example: inputBox.setFace("courier")

setSize(point)
Changes the font size to the given point size. Sizes from 5 to 36 points are legal.


Example: inputBox.setSize(12)

setStyle(style)
Changes font to the given style. Possible values are: "normal", "bold", "italic", and "bold italic".


Example: inputBox.setStyle("italic")

setTextColor(color)
Sets the color of the text to color.


Example: inputBox.setTextColor("green")