/xojo-web-badges

Bootstrap's Badges for (almost) any Web2 visual control

Primary LanguageXojoMIT LicenseMIT

xojo-web-badges

Bootstrap's Badges for Xojo Web.

This is a module that allows you to set badges on visual controls:
badges-screenshot

It contains two new methods, available in any control that inherits from WebUIControl:
module-extension-methods

Extension methods are a simple and powerful way to extend internal Xojo classes. You can read more about this module feature here:
Using Xojo Language > Modules > Extension Methods

How to use

Three simple steps:

  1. Download and open the project
  2. Copy the WebExtensions module into your project
  3. That's it, now you can use SetBadge and RemoveBadge on your controls

SetBadge

Used to set the badge on any WebUIControl. You can use the following parameters:

  • caption: The caption of the badge. If you just want to display a round circle, use an space
  • indicator: One of the Bootstrap's indicators: "primary", "secondary", "success", "danger" (default), "warning", "info", "light" or "dark"
  • top and right: Use these values to adjust the badge position. It will be -10 by default in both parameters

Example

UsernameTextField.SetBadge("OK", "success")
EmailTextField.SetBadge("It can't be blank")
PasswordTextField.SetBadge("Too little", "danger", -10, 30)
NotificationButton.SetBadge(" ")

RemoveBadge

Used to remove the badge from any WebUIControl.

Example

NotificationButton.RemoveBadge