question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: add SelectionStart and SelectionEnd to TrackBar

See original GitHub issue

You can set the TBS_ENABLESELRANGE on TrackBar and send the TBM_SETSELSTART and TBM_SETSELSTART to set the selection range See docs

Example: Screenshot 2020-01-06 at 16 31 38 Screen Recording 2020-01-06 at 04 32 pm

We could add the following APIs to TrackBar:

public class TrackBar
{
    ...
    public bool ShowSelectionRange { get; set; }
    public int SelectionStart { get; set; }
    public int SelectionEnd { get; set; }
    ...
}

Discussion

  • What should the default values of SelectionStart and SelectionEnd be if we haven’t enabled selections? In my experiments I set them to 0 which worked nicely.
  • In my prototype implementation, I set ShowSelectionRange to true if the user sets SelectionStart/SelectionEnd. One option could be to remove ShowSelectionRange and set SelectionStart/SelectionEnd to minus one or have some logic that sets the TrackBar style to TBS_ENABLESELRANGE if it is set to a custom value. However, this is negative as it leaves us with no way of removing the selection indicators once they’ve been created.
  • Do we want SelectionStart and SelectionEnd or SelectionStart and SelectionLength or some sort of SelectionRange struct that encapsulates this? (e.g MonthCalendar.SelectionRange)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
elachlancommented, Jan 9, 2023

@conorgee This is another trackbar improvement if you want to give it a go?

1reaction
RussKiecommented, Mar 5, 2020

Few questions:

  • Throw if SelectionLength < 0
  • Clamp SelectionStart to either Minimum or Maximum if outside the boundaries
  • Clamp if SelectionStart + SelectionLength > Maximum to Maximum
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to bind the SelectionStart, SelectionEnd, Value when ...
I've a TrackBarEdit whose style I can change from TrackBarStyleSettings to TrackBarRangeStyleSettings and vice versa.
Read more >
selectionStart/selectionEnd on input type="number" no ...
Use window.getSelection() to retrieve the selection object from the current input and then test extend the selection backwards (or forwards) and ...
Read more >
NET Design Review: WinForms Review
... Approved: Discussion/proposal: add more LVCOLUMN ComCtl 6.0 features ... Approved: add SelectionStart and SelectionEnd to TrackBar ...
Read more >
EBE Editor - GameGuru Forum
Hi Guys, I created this tool for a game and now the tool is finished and I forgot what I want to create....
Read more >
HTMLInputElement: setSelectionRange() method - Web APIs
The HTMLInputElement.setSelectionRange() method sets the start and end positions of the current text selection in an or element.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found