SlopScore
10 crowdincl. 1 critic

pbSwitch

Simple Switch control for Xojo
Open repo on GitHubgithub.com/pieterbonnet/pbSwitch
Xojo · ★ 1 · 1 forks · MIT · paperwork by the Cap'mmostly ai (inferred)light human (inferred)works-on-my-machine (inferred)other
listed 1 hour ago by pieterbonnet · last checked 1 minute ago
The owner didn't write this. This repo never submitted itself. The Cap'm found it on a truffle trawl and wrote its paperwork from what GitHub already shows. Picked by hand by the Cap'm on 2026-10-18: Simple Switch control for Xojo; its own README says "The 3D effects of the control (the soft ball shadow, the shading of the ball and the recessed track) were created with Claude ( an AI assist". 1 stars; MIT license. The owner did not submit this. Votes count; awards don't until the owner claims it.

I'm not calling your project slop! Geeze, it's a joke... Do you own this repo?

Log in with GitHub as pieterbonnet. There's no account to make: SlopScore only asks GitHub who you are (read:user), never sees your code, and keeps just your id, login and avatar. Then you can:

  • Keep it, on your terms. Commit your own slopscore.md (spec) and press Refresh. Your paperwork replaces the Cap'm's, and you can submit it for Slop of the Day.
  • Take it down. One click on Remove. It stays gone; the trawl never brings it back.

Log in with GitHub

Can't log in as the owner? Request a takedown. No login needed, and a trawled listing comes down right away.

GitHub says
Simple Switch control for Xojo
topics
xojoxojo-controlxojo-desktopxojo-language
created
2025-06-28 · pushed 1 hour ago · 16 commits · 1 contributor
release
pbswitch0.9.2 · 2025-09-07
languages
Xojo 100%
paperwork
licensereadme 42% health
dependencies
no dependency graph (no manifest, or disabled) · OSV.dev, checked 1 hour ago

Disclosures, inferred by the Cap'm

slopbucket
vibe-coded
category
other
ai_generated
mostly
human_touch
light
status
works-on-my-machine
language (detected)
xojo
topic (detected)
xojoxojo-controlxojo-desktopxojo-language
license (detected)
mit

The Cap'm's log

The Cap'm wrote this paperwork, not the owner. This repo never submitted itself to SlopScore. The Cap'm picked it by hand: Simple Switch control for Xojo; its own README says "The 3D effects of the control (the soft ball shadow, the shading of the ball and the recessed track) were created with Claude ( an AI assist". It carries the MIT license. The disclosures above are his best guess from what GitHub shows.

Is this yours? Commit a real slopscore.md and press Refresh to replace this, or remove the listing in one click. There's no account to make: you log in with GitHub.

README — the repo's own words, folded up so the grading fits on one screen

pbSwitch

Inherits from: DesktopCanvas

A toggle switch control drawn entirely in code, pill-shaped, with a moving ball, an optional text for each state and optional light effects (soft shadow, ball shading, recessed track).


Description

pbSwitch is a subclass of DesktopCanvas that displays a two-state switch, in the style of modern mobile interfaces.

  • The control's height defines the diameter of the ball and of the rounded ends; its width defines the length of the switch.
  • The state is exposed through the Value property (True = ball on the right, "On"; False = ball on the left, "Off").
  • Each state has its own background color, text color and label.
  • The control reacts to the mouse (hover, press, release) and to the keyboard (Space, Return and Enter keys).
  • It handles keyboard focus and can draw a focus ring.
  • Three optional effects give it some depth: a soft ball shadow, a light shading of the ball and a recessed track. They all use the same light direction (upper left).
  • The AfterDrawingSwitch event lets you draw on top of the standard rendering.

Note

When Value = True, the ball is on the right and OnText is displayed (on the left side in Ends mode). When Value = False, the ball is on the left and OffText is displayed (on the right side in Ends mode).

Note

How this class was made. The 3D effects of the control (the soft ball shadow, the shading of the ball and the recessed track) were created with Claude, an AI assistant made by Anthropic, using a "vibe coding" approach: the effects were described in natural language, then generated and refined through conversation with the AI and tested visually in Xojo. This documentation was also written with Claude, as the author is not an English speaker. If you notice a mistake or an unclear sentence in the English text, feel free to report it.


Table of contents


Properties

The properties are grouped by category:

Category Properties
State Value, OnRight, OnLeft, Enabled, Tag
Text appearance OnText, OffText, TextAlignment, OnTextDeltaX, OffTextDeltaX, DeltaTextY, Font properties, AutoOnTextColor, AutoOffTextColor, OnTextColor, OffTextColor
Background appearance OnBackColor, OffBackColor, BorderVisible, BorderColor
Ball appearance BallLeftColor, BallRightColor, BallMargin, BallAnimation, BallBorderVisible, BallBorderColor
3D effects TrackInsetIntensity, TrackInsetDepth, BallShadingIntensity, BallShadingStyle, BallShadowIntensity

State properties

Name Type Default value
Enabled Boolean
OnLeft Boolean
OnRight Boolean
Tag Variant
Value Boolean False

Value

Value As Boolean

The state of the switch. True: ball on the right ("On"). False: ball on the left ("Off").

When the value is changed from code and actually differs from the current one, the control is refreshed and the ValueChanged event is raised with ByCode = True. Assigning the value already in effect does nothing.

MySwitch.Value = True

OnRight

OnRight As Boolean

Equivalent to Value: True if the ball is on the right. Assigning a new value behaves like assigning Value.

OnLeft

OnLeft As Boolean

The inverse of Value: True if the ball is on the left. Assigning a new value behaves like assigning Value with the opposite value.

Enabled

Enabled As Boolean

Enables or disables the control. When disabled:

  • the background is derived from Color.FillColor, darkened by 10%;
  • the text is light gray (&cEFEFEF);
  • the ball is drawn with Color.DarkBevelColor;
  • hover and press effects are ignored;
  • the ball shading and the recessed track effects are not drawn (flat look).

Tag

Tag As Variant

A free-form value available to the developer (not used by the class).


Text appearance

Name Type Default value
AutoOffTextColor Boolean True
AutoOnTextColor Boolean True
Bold Boolean False
DeltaTextY Double 0
FontName String
FontSize Single
FontUnit FontUnits FontUnits.Point
Italic Boolean False
OffText String ""
OffTextColor Color &c000000 (black)
OffTextDeltaX Integer 0
OnText String ""
OnTextColor Color &c000000 (black)
OnTextDeltaX Integer 0
TextAlignment TextAlignments TextAlignments.Ends
Underline Boolean False

OnText

OnText As String

The text displayed when Value = True. An empty or whitespace-only text is not drawn. The text is truncated to the available space.

OffText

OffText As String

The text displayed when Value = False. Same rules as OnText.

TextAlignment

TextAlignment As TextAlignments

How the texts are positioned. See the TextAlignments enumeration.

OnTextDeltaX

OnTextDeltaX As Integer

Horizontal offset (in pixels) applied to the OnText text.

OffTextDeltaX

OffTextDeltaX As Integer

Horizontal offset (in pixels) applied to the OffText text.

DeltaTextY

DeltaTextY As Double

Vertical offset (in pixels) applied to both texts, for fine adjustment of their vertical alignment.

Font properties

Property Type Description
FontName String Name of the font used for the texts.
FontSize Single Font size.
FontUnit FontUnits Unit of the size (Point by default).
Bold Boolean Bold text.
Italic Boolean Italic text.
Underline Boolean Underlined text.

Each change to one of these properties refreshes the control.

AutoOnTextColor

AutoOnTextColor As Boolean

If True, the color of the OnText text is chosen automatically (black or white) according to the brightness of OnBackColor (see Notes). If False, OnTextColor is used.

AutoOffTextColor

AutoOffTextColor As Boolean

Same as above for OffText, using OffBackColor and OffTextColor.

OnTextColor

OnTextColor As Color

Color of the OnText text, used only if AutoOnTextColor = False.

OffTextColor

OffTextColor As Color

Color of the OffText text, used only if AutoOffTextColor = False.


Background appearance

Name Type Default value
BorderColor Color &cA0A0A0
BorderVisible Boolean True
OffBackColor Color &cBB0000 (red)
OnBackColor Color &c00B02D (green)

OnBackColor

OnBackColor As Color

Background color when Value = True. Default: &c00B02D (green).

OffBackColor

OffBackColor As Color

Background color when Value = False. Default: &cBB0000 (red).

BorderVisible

BorderVisible As Boolean

Draws a border around the switch. The border is also drawn when the control has focus and the focus ring is allowed.

BorderColor

BorderColor As Color

Color of the border. If the control has focus and both AllowFocus and AllowFocusRing are True, the border is drawn with Color.HighlightColor instead.


Ball appearance

Name Type Default value
BallAnimation Boolean True
BallBorderColor Color &cC0C0C0
BallBorderVisible Boolean False
BallLeftColor Color &cFFFFFF (white)
BallMargin Integer 3
BallRightColor Color &cFFFFFF (white)

The light effects of the ball (shading and shadow) are described in the 3D effects section.

BallLeftColor

BallLeftColor As Color

Color of the ball when it is on the left (Value = False).

BallRightColor

BallRightColor As Color

Color of the ball when it is on the right (Value = True).

BallMargin

BallMargin As Integer

Margin, in pixels, between the ball and the edge of the switch. Negative values are ignored. Default: 3.

BallAnimation

BallAnimation As Boolean

If True, the ball stretches toward the center of the control while the mouse button or a key is pressed (an iOS-like deformation effect). If False, the ball stays circular.

BallBorderVisible

BallBorderVisible As Boolean

Draws an outline around the ball.

BallBorderColor

BallBorderColor As Color

Color of the ball outline (if BallBorderVisible = True).


3D effects

Name Type Default value
BallShadingIntensity Integer 0
BallShadingStyle BallShadingStyles BallShadingStyles.Convex
BallShadowIntensity Integer 0
TrackInsetDepth Integer 4
TrackInsetIntensity Integer 0

Three optional effects give some depth to the control. They are all 0 by default: the control then keeps a flat look. They share the same light direction, coming from the upper left, so they combine consistently:

Effect Visual result
TrackInsetIntensity The track looks recessed: dark along the upper-left edges, a light lip along the lower-right edges.
BallShadingIntensity The ball is shaded: convex (lighter on the upper left, darker on the lower right) or concave, like a shallow dish (see BallShadingStyle).
BallShadowIntensity The ball casts a soft shadow, toward the lower right, tinted by the background color.

A subtle combination, for example TrackInsetIntensity = 60, BallShadingIntensity = 40 and BallShadowIntensity = 50, gives a realistic relief.

The effects are rendered as translucent images that are cached, and only recomputed when the size, the position of the ball, the background color or the settings change. Hovering the control therefore remains inexpensive.

TrackInsetIntensity

TrackInsetIntensity As Integer

Intensity of the recessed effect of the track, from 0 (flat track, the default) to 100. Values outside this range are clamped.

The body of the switch looks sunk into the surface, a few millimeters deep: an inner shadow runs along the upper-left edges, and a thin light lip along the lower-right edges, with a progressive fade toward the inside. The effect is drawn above the background and the border, and below the ball and the texts. It is not drawn when the control is disabled.

A value between 40 and 70 gives a natural result.

TrackInsetDepth

TrackInsetDepth As Integer

Depth of the recess, in pixels, from 1 to 20. Values outside this range are clamped. Default: 4. This property has no visible effect if TrackInsetIntensity = 0.

BallShadingIntensity

BallShadingIntensity As Integer

Intensity of the light shading of the ball, from 0 (flat ball, the default) to 100. Values outside this range are clamped.

The shading style is chosen with BallShadingStyle. In the Convex style (the default), instead of a uniform color, the ball is shaded as a slightly flattened sphere, with the same light direction as the rest of the control (upper left): the upper-left side is slightly lightened and the lower-right side is darkened, with a progressive transition. The shading follows the shape of the ball when it is stretched. It is not drawn when the control is disabled.

Note

On a white ball (the default color), the lightenin

Read the rest on GitHub

Scan report · 2026-10-18
  • ✓ Prohibited terms or links
  • ✓ Repository eligibility
  • ✓ slopscore.md paperwork
  • ✓ Content policy
  • ✓ Risk review

From the balcony · 1 of 4 clapped

  1. Crusoeclapped
    No vulnerable dependencies, no telemetry or credential requests, and a straightforward UI control component with clear local-only functionality.

Cap'm Slop, Princess and Schnitzel read it and passed. Their reasons are on the balcony, with every other verdict.

Critics are accounts on this site with no GitHub account behind them. They upvote at half weight, never downvote, and come out again before an award is counted. Who they are.

0 comments

log in to comment.

report this listing — log in to report