-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComboBox multiple fixes #710
Conversation
…ht not resizing. SetSource() not immeadiately updating list. Double click not selecting item. Example now demo resizes with view
@fergusonr, provide a functional constructor for the
In the |
Thanks. Fixed AllViewsTester.cs. Investigating Demo.cs issue.... |
Thanks. Is possible you have the default constructor to accept a ustring and using that to have a search and source filled with that information making visible? It's the way that |
Thanks. It's possible to have that text also into the source? May be this? Not tested.
|
The text (what your searching for) is independent to the source (your searching in) I think this, added to AllViewTesters.cs CreateClass() would be better for the IUCatalog, but it does not seem to initialize a ListView or ComboBox. Even though I can breakpoint in SetSource() and see its being set. if(view.GetType().GetMethod("SetSource") != null) {
IList<string> list = new List<string>() { "Test Text1", "Test Text2", "Test Text3" };
view?.GetType ().GetMethod ("SetSource")?.Invoke (view, new object [] { list });
} |
I think you are wright. It seems it's not initializing in the |
I can now get ListView and ComboBox scenario lists to initialize with this code change in addition to the one mentioned above in AllViewTesters.cs CreateClass Need @tig to comment on the validity of making this change // Instantiate view
var view = (View)Activator.CreateInstance (type);
view.Width = Dim.Fill (); // <-- Added
view.Height = Dim.Fill (); // <-- Added |
I will submit a PR to the |
Not sure why you need the constructor your asking for? It has no use outside of testing. The same can be achieved with this:- var combo = new ComboBox ("Test Text");
combo.SetSource(new List<string>() { "Test Text" }); |
I understand your point of view but when @tig insisted on default builders I didn't immediately understand his intention. Check my PR #712 and you will see that even having only one default driver with a simple text it fills the ListView with the generic application |
I'd rather not add code like this to AllViewsTester, because one of the values of this Scenario is to illustrate the default behavior of views (to expose bugs). |
IMO, given the code I just pushed in #713, when ComboBox is selected, it should show "Test Text" in the |
Of course it is just a record but it follows the same principle as the others. Now reading a |
I am checking in the image I sent that the ListView does not keep the focus on the current selected item. @tig could fix this, please :-) |
…ht not resizing. SetSource() not immeadiately updating list. Double click not selecting item. Example now demo resizes with view
…into combobox_fixes2
Thanks @tig Your not seeing the list for three reasons:-
Change the list items to this:- var source = new ListWrapper (new List<ustring> () {
ustring.Make("Test Text #1"), ustring.Make("Test Text #2"), ustring.Make("Test Text #3") });
View CreateClass (Type type) {
....
....
....
Application.Loaded?.Invoke (new Application.ResizedEventArgs () {
Rows = Application.Driver.Rows, Cols = Application.Driver.Cols });
return view;
} There is an issue in that the list does not appear until you give / remove focus on the Combo. Not clear where the problem lies at the moment. |
Application loaded is not the right event. Use LayoutComplete.
…-cek
Sent from mobile device. Expect brevity, typos, and dangerous driving.
________________________________
From: Ross Ferguson <[email protected]>
Sent: Saturday, June 20, 2020 11:26:29 PM
To: migueldeicaza/gui.cs <[email protected]>
Cc: Charlie Kindel ([email protected]) <[email protected]>; Mention <[email protected]>
Subject: Re: [migueldeicaza/gui.cs] ComboBox multiple fixes (#710)
IMO, given the code I just pushed in #713<#713>, when ComboBox is selected, it should show "Test Text" in the TextField and List Item #1 (2 & 3) in the List. It does not do that now.
Thanks @tig<https://github.com/tig> Your not seeing the list for three reasons:-
* 1 There's a fix in this PR required
* 2 The "Test Text" does not match anything in the source list items
Change the list items to this:-
var source = new ListWrapper (new List<ustring> () {
ustring.Make("Test Text #1"), ustring.Make("Test Text #2"), ustring.Make("Test Text #3") });
* 3 The scenario environment is not fully emulating the real environment. Application.Loaded is not getting fired. Need this at the end of AllViewsTester.CreateClass()
View CreateClass (Type type) {
....
....
....
Application.Loaded?.Invoke (new Application.ResizedEventArgs () {
Rows = Application.Driver.Rows, Cols = Application.Driver.Cols });
return view;
}
[UICatalog ComboBox]<https://user-images.githubusercontent.com/17233550/85218217-02b06a80-b390-11ea-9d74-90b0148b386b.JPG>
There is an issue in that the list does not appear until you give / remove focus on the Combo. Not clear where the problem lies at the moment.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#710 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEO6CWHP4ZWJM6NV5OVIXDRXWRZLANCNFSM4ODJI5AQ>.
|
@fergusonr can you add a down arrow that will open or close the list items of the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great progress. Thanks a ton for all your hard work on this.
See my notes on using brackets for nested statements.
Also, ApplicationLoaded is not the right event. Use LayoutComplete.
@fergusonr I inserted a |
You can test my branch here (https://github.com/BDisp/gui.cs/tree/combobox-multiple-fixes) but @fergusonr will make your final decision as the author of the control. I just insisted that it is a |
Test dir more robust "\Windows" Use ListViewItemEventArgs
Yes, the Unicode issue was fixed a good while back in this PR. var comboBox = new ComboBox ("gui.cs") {
X = 20,
Y = Pos.Y (label),
Width = Dim.Percent (50),
Height = Dim.Percent(20)
}; I believe this PR is ready to go. I've hand picked two of @BDisp changes. Any wider changes can be done in a new PR post v0.90 / v1.00. AutoHide for example should be made a public property so it can be overwritten Note that PR #724 is in this branch Thankyou both for all your help and patience |
… combobox_fixes2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great work. You've simplified things greatly.
I appreciate your taking the feedback!
Terminal.Gui/Core/View.cs
Outdated
@@ -596,6 +607,7 @@ public virtual void Remove (View view) | |||
if (view == null || subviews == null) | |||
return; | |||
|
|||
OnRemoving (view); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove Removing
from this PR. I have serious concerns about how it will interact with IDisposable
and we don't have a clear use case where it's needed. I wish I could explain those concerns in detail, but I'm not confident I understand well enough yet. But I've learned to trust my instincts on things like this. There's no danger in removing the API for now. But there is danger in putting it in and having to change it later. Thanks.
Also, I am arguing for renaming Adding
to Added
. I made a comment that argues my point I think pretty clearly. I'll add to that argument that by using Adding
(current tense) there's an implication that the operation can be cancelled. However, if we name it Added
(past tense) it is very clear that the deal is done and there's no going back.
If you disagree, please explain. If you don't disagree, please rename to Added
.
I think there is no harm in maintaining |
I think I've made my argument pretty clear. Beyond my concerns that the semantics around If you feel strongly that |
@tig if you prove it will create conflicts with the |
@fergusonr can you take a look for this small adjustments I have made to improve the https://github.com/BDisp/gui.cs/tree/pr%23710-combobox-multiple-fixes |
SelectedItem (read only) from @BDisp OpenSelectedItem
@fergusonr, please merge my PR #723 again because I changed the After selecting an item, the ComboBox closes but no longer opens either by clicking on the down arrow or with the cursor down. |
When |
With the mouse, the |
FIxes for #709