top of page

IPAddressField for Xojo


IPAddressField is my first user-control for Xojo. It's an input box that allows your user to specify an IP address. It enforces valid IP addresses only. This offers many advantages over a standard TextField to collect an IP address from your users.

 

The control looks and behaves like the one built into Windows TCP/IP properties.

Properties

  • AutoScaleText - This enables/disables automatic font-scaling when the control is resized. Depending on the font you use, you may need to tweak the scaling algorithm in the control's private .Resize event handler.

  • BackColor - This sets/returns the background color of the control.

  • BorderColor - This sets/returns the color of the border around the control.

  • IPAddress - This sets/returns the IP address that the control is currently displaying.

  • TextColor - This sets/returns the color of the font in the control, and the periods between octets.

  • TextFont - This sets/returns the name of the font to use in the control for input and periods between octets.

  • TextSize - This sets/returns the size of the font to use in conjunction with .TextFont. Setting this value when .AutoScaleText is True will have no effect.

  • Version - (read only) Returns the version number of the control.

Methods

  • About - Displays an "About" dialog for the control.

  • Clear - Clears all four octets and resets the control to 0.0.0.0

  • SetCursorToField (FieldNumber as integer, optional ClearField as boolean) Sets the cursor to a particular octet in the IP address field. FieldNumber must be between 1-4. If ClearField is True or unspecified, the control will blank out that octet and set the cursor in the field. If ClearField is false, the entire text of the octet will be selected.

Events

  • IPAddressChanged - Raised when the IP address entered into the control changes, either programmatically or through typing.

All-in-all, this is a simple, yet useful control, all inside a ContainerControl.

I am releasing it open-source under the FreeBSD 2-Clause License.




bottom of page