[PR #368] Add support for displaying text next to a checkbox #929

Open
opened 2026-03-04 01:08:36 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/368
Author: @berrange
Created: 11/14/2019
Status: 🔄 Open

Base: masterHead: checkbox-text


📝 Commits (1)

  • 7e75a30 Add support for displaying text next to a checkbox

📊 Changes

3 files changed (+27 additions, -3 deletions)

View changed files

📝 checkbox.go (+26 -2)
📝 demos/checkbox/main.go (+1 -1)
📝 demos/checkbox/screenshot.png (+0 -0)

📄 Description

When building forms the label field is typically quite short, just one
or two words. For checkboxes it is often desirable to have a longer
descriptive piece of text. This is not practical to use as a label and
in many applications would more commonly be placed to the right of the
checkbox.

This adds support for a "SetMessage()" method which provides support
for text adjacent to the checkbox

As an example, this form shows one usage pattern, where the checkbox
is used to require case sensitive matching of the author name query.
In this case the checkbox label is an empty string, and the message
text is used instead:

 ╔════════════ User filtering ════════════════════╗
 ║                                                ║
 ║    Age:   ________                             ║
 ║                                                ║
 ║ Author:   ______________                       ║
 ║                                                ║
 ║           X Case sensitive                     ║
 ║                                                ║
 ║   Apply     Cancel                             ║
 ╚════════════════════════════════════════════════╝

Another pattern is where there are a series of checkboxes, all
related to the same attribute. Thus they have a common form
label but different message text

 ╔════════════ Request filtering ═════════════════╗
 ║                                                ║
 ║    State:    X Opened                          ║
 ║                                                ║
 ║              _ Closed                          ║
 ║                                                ║
 ║              _ Merged                          ║
 ║                                                ║
 ║              X Locked                          ║
 ║                                                ║
 ║   Apply     Cancel                             ║
 ╚════════════════════════════════════════════════╝

Signed-off-by: Daniel P. Berrangé berrange@redhat.com


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rivo/tview/pull/368 **Author:** [@berrange](https://github.com/berrange) **Created:** 11/14/2019 **Status:** 🔄 Open **Base:** `master` ← **Head:** `checkbox-text` --- ### 📝 Commits (1) - [`7e75a30`](https://github.com/rivo/tview/commit/7e75a30f543859b725997d86fccd03d73c28a273) Add support for displaying text next to a checkbox ### 📊 Changes **3 files changed** (+27 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `checkbox.go` (+26 -2) 📝 `demos/checkbox/main.go` (+1 -1) 📝 `demos/checkbox/screenshot.png` (+0 -0) </details> ### 📄 Description When building forms the label field is typically quite short, just one or two words. For checkboxes it is often desirable to have a longer descriptive piece of text. This is not practical to use as a label and in many applications would more commonly be placed to the right of the checkbox. This adds support for a "SetMessage()" method which provides support for text adjacent to the checkbox As an example, this form shows one usage pattern, where the checkbox is used to require case sensitive matching of the author name query. In this case the checkbox label is an empty string, and the message text is used instead: ``` ╔════════════ User filtering ════════════════════╗ ║ ║ ║ Age: ________ ║ ║ ║ ║ Author: ______________ ║ ║ ║ ║ X Case sensitive ║ ║ ║ ║ Apply Cancel ║ ╚════════════════════════════════════════════════╝ ``` Another pattern is where there are a series of checkboxes, all related to the same attribute. Thus they have a common form label but different message text ``` ╔════════════ Request filtering ═════════════════╗ ║ ║ ║ State: X Opened ║ ║ ║ ║ _ Closed ║ ║ ║ ║ _ Merged ║ ║ ║ ║ X Locked ║ ║ ║ ║ Apply Cancel ║ ╚════════════════════════════════════════════════╝ ``` Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#929
No description provided.