XUIInspectorTextFieldItem
Implements XUIInspectorItem
, XUIInspectorItemKeyHandler
Description
An item containing an editable text field beside a caption.
Properties
Name | Type | Read-Only |
---|---|---|
Caption | String |
|
CaptionWidth | Integer |
|
HasFocus | Boolean |
|
mBounds | Rect |
|
mCaption | String |
|
mContentsWhenActivated | String |
|
mID | String |
|
mLastNewlineEvent | Double |
|
mOwner | WeakRef |
|
mPlaceholder | String |
|
mSection | WeakRef |
|
mTextField | XUIInspectorTextFieldRenderer |
|
mTextFieldBounds | Rect |
|
mTextFieldWidth | Integer |
|
Placeholder | String |
Methods
Name | Parameters | Returns |
---|---|---|
Bounds | Rect |
|
Bounds | Assigns b As Rect |
|
CanAcceptTabFocus | Boolean |
|
Constructor | id As String , caption As String , captionWidth As Integer , placeHolder As String |
|
DidReceiveTabFocus | ||
DoCommand | command As String |
|
HandleNewline | ||
Height | style As XUIInspectorStyle |
Double |
ID | String |
|
InsertCharacter | char As String , range As TextRange |
|
LostFocus | ||
MouseDown | x As Integer , y As Integer , clickType As XUI.ClickTypes |
XUIInspectorMouseDownData |
MouseExit | Boolean |
|
MouseMoved | x As Double , y As Double |
XUIInspectorMouseMoveData |
MouseUp | x As Integer , y As Integer , clickType As XUI.ClickTypes |
XUIInspectorMouseUpData |
Owner | XUIInspector |
|
Owner | Assigns inspector As XUIInspector |
|
PopupDismissed | ||
PopupItemSelected | index As Integer |
|
RectForRange | range As TextRange |
Xojo.Rect |
Render | g As Graphics , x As Double , y As Double , width As Double , style As XUIInspectorStyle |
Double |
Section | XUIInspectorSection |
|
Section | Assigns section As XUIInspectorSection |
Constants
Name | Type |
---|---|
HPADDING | Double |
NEWLINE_EVENT_DELAY | Double |
TEXTFIELD_CONTENT_VPADDING | Double |
VPADDING | Double |
HPADDING As Double The number of pixels to pad the item's content left and right.
NEWLINE_EVENT_DELAY As Double The number of microseconds to wait between accepting two consecutive newline insertion events.
TEXTFIELD_CONTENT_VPADDING As Double The number of pixels to pad the contents of the text field from the text field borders.
VPADDING As Double The number of pixels to pad the text field above and below.
Property Descriptions
Caption As String
The caption to display next to the text field.
CaptionWidth As Integer
The desired width of the caption.
HasFocus As Boolean
If True then the text field has the focus.
mBounds As Rect
The bounds of this item.
mCaption As String
The caption to display next to the text field.
mContentsWhenActivated As String
The contents of the text field when last activated.
mID As String
Used to identify this item in notifications. You should ensure it is unique within the inspector.
mLastNewlineEvent As Double
When the last newline insertion event was handled.
mOwner As WeakRef
A weak reference to the inspector this item belongs to.
mPlaceholder As String
Optional placeholder for the text field.
mSection As WeakRef
A weak reference to the inspector section this item is within. May be Nil.
mTextField As XUIInspectorTextFieldRenderer
This item's text field.
mTextFieldBounds As Rect
The bounds of the text field.
mTextFieldWidth As Integer
The width of the text field.
Placeholder As String
Optional placeholder for the text field.
Method Descriptions
Bounds() As Rect
The bounds of this item within the inspector.
Part of the XUIInspectorItem interface.
Bounds(Assigns b As Rect)
Sets the bounds of this item in the inspector.
Part of the XUIInspectorItem interface.
CanAcceptTabFocus() As Boolean
Returns True if this item is able to accept the focus via the tab key.
Constructor(id As String, caption As String, captionWidth As Integer, placeHolder As String)
Constructs a new item with an editable text field. The text field can have a optional placeholder text.
DidReceiveTabFocus()
This item has just received the focus via the tab key.
DoCommand(command As String)
A key command has occurred.
Part of the XUIInspectorItemKeyHandler
interface.
HandleNewline()
Handle the insertion of a newline (i.e the return key).
Height(style As XUIInspectorStyle) As Double
The height of this item given the desired style.
Part of the XUIInspectorItem interface.
ID() As String
Used to identify this item in notifications. You should ensure it is unique within the inspector.
Part of the XUIInspectorItem interface.
InsertCharacter(char As String, range As TextRange)
The user is attempting to insert a single character into this item.
Part of the XUIInspectorItemKeyHandler
interface.
LostFocus()
This item just lost the focus.
Part of the XUIInspectorItem
interface.
MouseDown(x As Integer, y As Integer, clickType As XUI.ClickTypes) As XUIInspectorMouseDownData
Tells the item that a mouse down event has occurred within its bounds. x, y are the absolute coordinates relative to the inspector (adjusted for scrolling). Returns a MouseDownData instance instructing the inspector how to handle the event or Nil if the click didn't occur in this item.
Part of the XUIInspectorItem interface.
MouseExit() As Boolean
Used to tell this item that the mouse has just exited it. Returns True if the inspector should redraw.
Part of the XUIInspectorItem interface.
MouseMoved(x As Double, y As Double) As XUIInspectorMouseMoveData
The mouse has just moved over this item. Returns data to inform the inspector how to handle the movement. May return Nil.
Part of the XUIInspectorItem interface.
MouseUp(x As Integer, y As Integer, clickType As XUI.ClickTypes) As XUIInspectorMouseUpData
Tells the item that a mouse up event has occurred within its bounds. x, y are the absolute coordinates relative to the inspector (adjusted for scrolling). Returns a MouseUpData instance instructing the inspector how to handle the event or Nil if the click didn't occur in this item.
Owner() As XUIInspector
A weak reference to the inspector this item belongs to.
Part of the XUIInspectorItem interface.
Owner(Assigns inspector As XUIInspector)
The inspector this item belongs to. A weak reference will be created.
Part of the XUIInspectorItem interface.
PopupDismissed()
Tells this item that any popup it thinks it has displayed has been dismissed with no action.
Part of the XUIInspectorItem
interface.
PopupItemSelected(index As Integer)
The entry at index
has been selected in this item's popup menu.
Part of the XUIInspectorItem interface.
RectForRange(range As TextRange) As Xojo.Rect
Return a range for macOS to display the character picker.
I'm being lazy here and returning an arbitrary width and height because for our purposes we are only interested in the popup being positioned at the correct location. This will likely mean that I'm not fully supporting advanced uses of this event but since I don't actually understand the event, that's OK by me.
Render(g As Graphics, x As Double, y As Double, width As Double, style As XUIInspectorStyle) As Double
The item should render itself to the passed graphics context at the specified location. Returns the position of the item's bottom edge.
Part of the XUIInspectorItem interface.
|--------------------------|
| CAPTION [ TEXT FIELD ] |
|--------------------------|
Section() As XUIInspectorSection
A weak reference to the section this item is in.
Section(Assigns section As XUIInspectorSection)
The section this item is within to. A weak reference will be created.