lulalala
lulalala

Reputation: 17991

A better GUI control for a list of text items?

I have a WinForm application. It needs a list of user defined rules. Inside each rule there will be a list of text items (also entered by the user).

Currently I have a grid (SourceGrid). Each row is a rule. In each rule I have a textbox, allowing the user to enter multiple text items (the screen shows example of several regular expressions).

Textbox with a list of text items

I have user enter 'tab character' to separate each item. Some rule may have one item and some may have 10s of items. That's why I think it is easier to use only one textbox and allow the user the delimit the items themselves.

However now I found that the tab character is quite limiting, because sometimes items are 1 character apart, and sometime more. (in the screenshot it's hard to distinguish the first and second item, just by luck).

I was thinking of having the tab character making two items fixed distance apart. No that's no possible. I don't want to use other delimiting characters because it makes the whole thing less readable. I also don't want to code to dynamically create more columns. I was thinking about these IP address boxes for user to enter, but those are not build-in and can't be vary in width.

I want to ask if there is a better way to represent this without coding a control from scratch? Or is it possible to have a special wider space character act as the delimiter for the items? Thanks.

Upvotes: 2

Views: 150

Answers (1)

Dmitry Polomoshnov
Dmitry Polomoshnov

Reputation: 5364

You may use ANY white-space character sequence between items as a separator. So user may put any spaces (or tabs). You may parse input then, and fix these separators to fixed length if you want. It's a simple solution if you have no spaces inside each item.

But for better solution I'd prefer multine-text for each item, so every single rule occupies it's own line. It depends on context though.

Upvotes: 1

Related Questions