Skip to content

XUIInspectorDualTextFieldItem

Implements XUIInspectorItem, XUIInspectorItemKeyHandler, XUIInspectorItemWithMultipleTabFocusControls

Description

An item with two text fields, one above the other.

Properties

Name Type Read-Only
BottomCaption String
BottomHasFocus Boolean
BottomPlaceholder String
Caption String
CaptionWidth Integer
mBottomContentsWhenActivated String
mBottomTextField XUIInspectorTextFieldRenderer
mBottomTextFieldBounds Rect
mBounds Rect
mCaption String
mID String
mLastNewlineEvent Double
mMaxTextFieldCaptionWidth Double
mOwner WeakRef
mSection WeakRef
mTextFieldWidth Integer
mTopContentsWhenActivated String
mTopTextField XUIInspectorTextFieldRenderer
mTopTextFieldBounds Rect
TopCaption String
TopHasFocus Boolean
TopPlaceholder String

Methods

Name Parameters Returns
Bounds Rect
Bounds Assigns b As Rect
CanAcceptAnotherTabFocus Boolean
CanAcceptTabFocus Boolean
Constructor id As String, caption As String, captionWidth As Integer, topCaption As String, bottomCaption As String, topPlaceHolder As String, bottomPlaceHolder As String
DidReceiveTabFocus
DoCommand command As String
DrawTextFieldCaption s As String, baseline As Double, x As Double, y As Double, w As Double, h As Double, g As Graphics, style As XUIInspectorStyle
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_CAPTION_INTERNAL_PADDING Double
TEXTFIELD_CONTENT_VPADDING Double
TEXTFIELD_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_CAPTION_INTERNAL_PADDING As Double The number of pixels to pad the left and right of a text field caption from its borders.


TEXTFIELD_CONTENT_VPADDING As Double The number of pixels to pad the contents of the text field from the text field borders.


TEXTFIELD_VPADDING As Double The number of pixels to pad vertically between the two textfields.


VPADDING As Double The number of pixels to pad the text field above and below.


Property Descriptions

BottomCaption As String

The bottom textfield's caption.


BottomHasFocus As Boolean

If True then the bottom text field has the focus.


BottomPlaceholder As String

Optional placeholder for the bottom text field.


Caption As String

The caption to display next to the text field.


CaptionWidth As Integer

The desired width of the caption.


mBottomContentsWhenActivated As String

The contents of the bottom text field when last activated.


mBottomTextField As XUIInspectorTextFieldRenderer

The bottom text field.


mBottomTextFieldBounds As Rect

The bounds of the bottom text field.


mBounds As Rect

The bounds of this item.


mCaption As String

The caption to display next to the text field.


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.


mMaxTextFieldCaptionWidth As Double

The width of the widest text field caption. Computed in Render.


mOwner As WeakRef

A weak reference to the inspector this item belongs to.


mSection As WeakRef

A weak reference to the inspector section this item is within. May be Nil.


mTextFieldWidth As Integer

The width of the text field.


mTopContentsWhenActivated As String

The contents of the top text field when last activated.


mTopTextField As XUIInspectorTextFieldRenderer

The top text field.


mTopTextFieldBounds As Rect

The bounds of the top text field.


TopCaption As String

The top textfield's caption.


TopHasFocus As Boolean

If True then the top text field has the focus.


TopPlaceholder As String

Optional placeholder for the top 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.


CanAcceptAnotherTabFocus() As Boolean

Returns True if pressing the tab key should move the focus to another control within this item.

Part of the XUIInspectorItemWithMultipleTabFocusControls 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, topCaption As String, bottomCaption As String, topPlaceHolder As String, bottomPlaceHolder As String)

Constructs a new item with two editable text fields. Each text field can have an optional fixed caption beside it and 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.


DrawTextFieldCaption(s As String, baseline As Double, x As Double, y As Double, w As Double, h As Double, g As Graphics, style As XUIInspectorStyle)

Draws a text field caption s to g at x, y with width w and height h. If s is empty then nothing is drawn.


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   T [ TEXT FIELD ] |
|           B [ TEXT FIELD ] |
|----------------------------|

```nohighlight

T: Top caption.
B: Bottom caption.

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.