Conversation
CharliePoole
left a comment
There was a problem hiding this comment.
Looks good. I'm suggesting one change in the textbox element for consistency within the set of ui elements.
| /// - show a PlaceHoder text if there's no text input | ||
| /// - Invoke the SelectionChanged event as soon as no further input is made within a short period of time. | ||
| /// </summary> | ||
| public class TextBoxElement : ISelection |
There was a problem hiding this comment.
ISelection seems like an odd interface to use here, since there are no choices from which to select. Do we need an IChanged interface? Also, why not inherit from ToolStripElement, the base class for such elements?
|
I think I opted the I'll prepare a commit for this one. I also thought again about inheriting the class from ToolStripElement: that'll work of course now. However I plan to reuse this |
…in class TextBoxElement
|
This commit adds a new interface IChanged and use this interface instead of ISelection in class TextBoxElement. |
|
Regarding this idea...
I first created the UI Elements to encapsulate various kinds of controls under the NUnit V2 GUI. For TestCentric, I wanted to use more modern UI components that had been introduced into Windows. The Windows Forms One side issue... in Windows Forms, there is a third hierarchy based on I think it's best to keep this structure of two hierarchies using some common functional interfaces, which are not connected with UI appearance at all. For example, UPDATE I was initially confused because you had referred to your filterTextBox as a Control. I see now that it's a ToolStripItem and is on the other side of the hierarchy split from what I first thought. Windows ToolStripTextBox is, of course a specialized ToolStripControlHost, containing a textbox. I think we should be careful about keeping the split between elements that represent ToolStripItems and those that represent Controls, but it's possible to do what you suggest by moving some of the specialized functiondown into the control itself. Let's not do it till it's needed however. :-) |
CharliePoole
left a comment
There was a problem hiding this comment.
This looks good to me. Suggestions are optional, just let me know what you do.
| /// - show a PlaceHoder text if there's no text input | ||
| /// - Invoke the Changed event as soon as no further input is made within a short period of time. | ||
| /// </summary> | ||
| public class TextBoxElement : IChanged |
There was a problem hiding this comment.
| public class TextBoxElement : IChanged | |
| public class ToolStripTextBoxElement : ToolStripElement, IChanged |
ToolStripElement already implements many of the basic properties. Suggested name change is consistent with our naming of other tool strip elements.
There was a problem hiding this comment.
Ok, you've convinced me 👍 !
I will rename this class to ToolStripTextBoxElement and derive it from base class ToolStripElement.
| TextBox.Focus(); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Is the timeout strictly necessary? I'm fairly accustomed to controls that do nothing until I tab away or otherwise change focus.
There was a problem hiding this comment.
This 'timeout' feature is definitely just a gimmick and not absolutely necessary.
When I was working with the text filters, I found it helpful that the results were displayed quickly without additional key stroke. And that I can continue typing immediately if I wasn't satisfied with the result. That's why I had the idea of introducing this timer. Of course, this is not a brand new idea, but some other programs use this in their search as well. So from my point of view it's beneficial for the user and I prefer to keept this feature. But of course we can remove it, if users are annoying by this feature...
Thanks for the explanation of the two derivation hierarchies: |
…m base class ToolStripElement
This PR contributes to issue #1161 by adding a Textbox in the Filter ToolStrip to enable the textual filtering of tests.

Here's a screenshot:
Here's a list of the functionality:
Not included:
Technical view:
The main contribution of this commit are the two new UI classes
StretchToolStripTextBoxandTextBoxElement.The class
StretchToolStripTextBoxis only required to stretch the TextBox in the ToolStrip over the complete width. Without this implementation the TextBox width will remain fixed (for example 200 pixel). I'm glad that I found this solution in the microsoft documentation.The class
TextBoxElementhandles the TextBox input. It implements the ISelection interface so that the presenter class don't depent on any UI elements, but just use the ISelection.SelectedItem and ISelection.SelectionChanged event.