class CEdit __init__(self, parent, initial_text, nchars = None) Class CEdit represents an edit (or entry) control, a one-line box in which the user types and edits text. To read the text after the user has entered it, use GetWindowText(). If the edit control is in a dialog box, the Enter and Esc keys will dismiss the dialog box as usual, even if the Edit Control has focus. Instance Variables wpyParent, wpyText, wpyChildList, wpySizeX/Y, wpyLocX/Y wpyPasswordChar, char or None, readonly after Create() If this is changed from None to a character such as "*", then that character will be shown in the control rather than the characters actually typed. wpyTextColor, the tuple (r, g, b) Sets the text color to the given color. wpyBrush, an instance of a CBrush (don't forget to Create() it). Sets the background color to the color of the brush. Methods __init__(self, parent, initial_text, nchars = None) Return an editbox with self.wpySizeX/Y set according to the arguments given. parent, object The view or dialog parent of the control. initial_text, string The initial text to display in the edit control. Assigned to wpyText. nchars, int or None The size of the editbox is nchars average characters if given, else it is the size of initial_text if given, else it is 10 characters. Create(self) Make the editbox visible by calling the underlying GUI. SetSel(self, char1, char2) Set the selection to the range char1 to char2, and set the cursor to just before char2. If char1 == char2, just set the cursor, not the selection. Use a large char2 (such as 999) to indicate the end of the edit control. SetWindowText(self, text) Write the text to the editbox replacing any existing text. GetWindowText(self) Get the edited text from the editbox. Returns a string. LimitText(length) Limit the length of text which the user can enter. This is not supported by Tk. Messages OnChar(self, char, flags) Sent to the edit control when the user presses a key. Useful for dismissing the edit control when the user presses "enter". If the edit control is in a dialog box, the dialog box will be dismissed when the user presses "enter" or "esc". OnEditChange(self, control) Sent when the edit control has changed. This may be sent for each key stroke, so it must be efficient. class CMultiEdit __init__(self, parent, initial_text, nchars = None, nlines = 4) Class CMultiEdit represents a multi-line edit control. It is similar to CEdit, except for supporting multiple lines. The methods used to access the text are the same as used for CEditView. Use of SetWindowText() and GetWindowText() requires return-newline on Windows and newline alone on Tk, so use of these should be avoided. Use WpyAppend to add lines with or without lineends instead. Also, initial_text must be just one line (the longest line for sizing) if it is used. To include scroll bars on a CMultiEdit, set self.wpyHScrollSize and/or self.wpyVScrollSize to non-zero. The size of the scroll bars is available as self.wpyScrollWidth, and is not included in the size returned from the constructor. Messages OnVScroll(self, control) OnHScroll(self, control) Sent when the user operates the scroll bar of a multiline edit control. The wpyVScrollPos is updated to the index of the first visible line. wpyHScrollPos is always zero. Examples # Create a label and editbox. editlabel = CLabel(self, "Edit: ") editlabel.wpyLocX = x editlabel.wpyLocY = y editlabel.Create() editbox = CEdit(self, "initial text", 20) editbox.wpyLocX = x + editlabel.wpySizeX editbox.wpyLocY = y editbox.Create()