 |
|
 |
Well, I think it is possible, but it wouldn't be very easy, because it would require to 'mess' with custom regions. I've tried it once but finally I've replaced it with AnimateWindow API.
Regards,
Łukasz
|
|
|
|
 |
|
 |
I find it very useful
/PL01
|
|
|
|
 |
|
 |
Dzięki
|
|
|
|
 |
|
 |
Although It's a nice article, and I'm sure many will or already have found it helpful, I totally disagree with the concept.
Pop-up windows were developed many years ago, when there's no .NET, etc... and the idea and purpose was and for many still is very simple: to display a dialog, tooltip, info box, "put your name here" outside of the main application window, for informative purposes.
What you've presented in your article is changing the whole concept into something completely different (apart from tooltip control), and the whole idea is getting lost "somewhere".
1. I disagree that the popup window shouldn't steal focus from its parent. Who decided that popup windows shouldn't steal focus? Which windows is stealing focus and which isnt't depends on the situation and specific needs.
In fact, logically thinking, there should be only one control on the screen with focus - this is one of the principles of Windows programming. If you want do allow user to do something in your popup, like select something from combobox (one of the examples), then focus should migrate to that combobox and return it back when the popup is closed.
2. Popup windows are different from POP-UPs. POP-UPs are exploited by advertising companies to steal user's focus (attention) and display whatever they were created for. Popup windows are tools that should be used for specific purposes, mostly informative, like tooltips or contextual help. If they steal focus, it means that they seek/require user's attention, and this is by design.
3. Creating applications that leave users with few controls having focus at the same time on the screen is wrong and misleading.
Imagine disabled people using someone's software designed with such idea in mind, who's having troubles using it, because there's 5 popups on top of the window with focus - which have focus too (that's just one example).
I'd rather urge developers to learn proper UI design techniques, and treat such ideas with some distance, always trying to develop application with all people in mind (which doesn't mean they have to be ugly or not have fancy controls). You can't even imagine how many applications on the market are not suitable for disabled people, or people with little computer use knowledge - believe me - more than 75%.
So, summarizing: I still think this is nice article, and your idea is good, but has practical flaws.
I hope I didn't hurt anyone.
Cheers,
Gal
|
|
|
|
 |
|
 |
"develop application with all people in mind", really all people? I don't think so, I think Lukasz's pop-up control is cool enough.
set Popup control's AutoClose property as false can solve the problem of
stealing focus from its parent when the popup control showing, but it
is not easy to close the popup control automaticly. Is there a way to close
the popup control automaticly and don't stealing focus from its parent
when the popup control is showing?
|
|
|
|
 |
|
 |
Thank you for your constructive message.
Galatei wrote: 2. Popup windows are different from POP-UPs. POP-UPs are exploited by advertising companies to steal user's focus (attention) and display whatever they were created for. Popup windows are tools that should be used for specific purposes, mostly informative, like tooltips or contextual help.
I agree. I submitted an updated article in which I changed all occurrences of pop-up to popup since the article is not about ads.
Galatei wrote: 1. I disagree that the popup window shouldn't steal focus from its parent. Who decided that popup windows shouldn't steal focus? Which windows is stealing focus and which isnt't depends on the situation and specific needs.
In fact, logically thinking, there should be only one control on the screen with focus - this is one of the principles of Windows programming. If you want do allow user to do something in your popup, like select something from combobox (one of the examples), then focus should migrate to that combobox and return it back when the popup is closed.
3. Creating applications that leave users with few controls having focus at the same time on the screen is wrong and misleading.
Remember that the popup window should be a small part of a control/window, it should be light, so it could be treated like a real part of the control it belongs to (just like popup list of the combobox, popupmenu of the window), and as a part of that control it shouldn't steal "visual focus" (I explained it further). I admit that my example "more complex popup" is a little too complex for a popup window and it should either steal focus or be transformed into a dialog box. I also should've written that "not stealing focus" means only that the title bar of the window is not redrawn as an inactive (the "visual focus" is not stolen, but the actual focus is). The focus is only in one window at once, so if the popup is not a tooltip, but some interactive popup (like combobox list, menu, popup menu), and user clicks on that popup, the popup steals focus from the main window, but prevents the title bar from redrawing as inactive (or does not steal focus at all, just like popup menus don't).
Only the separate parts of the application (like other windows or dialog boxes) should steal focus from the main window. Well, that my personal opinion on that subject.
Galatei wrote: Imagine disabled people using someone's software designed with such idea in mind, who's having troubles using it, because there's 5 popups on top of the window with focus - which have focus too (that's just one example).
I'd rather urge developers to learn proper UI design techniques, and treat such ideas with some distance, always trying to develop application with all people in mind (which doesn't mean they have to be ugly or not have fancy controls). You can't even imagine how many applications on the market are not suitable for disabled people, or people with little computer use knowledge - believe me - more than 75%.
Hm... creating UI for disabled people can be tricky. It depends on the disablement (I hope it's the correct word). Personally, I always try to implement controls in way that they can be used either by mouse or by keyboard, but I don't if it's enough for disabled people.
I know that many applications are not suitable for people either disabled or with little knowledge. Many applications have terribly unclear or messed UI, because unfortunately some programmers think only about functionality, not usability.
It's great that Microsoft created UX Guide in which they explains how to create clear and usable UI. It should be read by every programmer which creates UI for Windows applications.
Once more, thanks for your post
Regards,
Łukasz
|
|
|
|
 |
|
 |
Who decided that popup windows shouldn't steal focus?
Hi Gal,
Have you tried creating your own combobox usercontrol that integrates seamlessly with the form? i.e. your control shouldn't steal focus when it is being shown.
Why this should be? That is to make your program user-friendly, you don't want your user to press escape key(or click X) incessantly when they accidentally click your combobox control but want to proceed to the next control instead. Combobox control shouldn't be modal(i.e. stealing focus). Your program should allow users to click other controls even if your combobox control was shown.
Regards,
Kel
P.S.
Best of all, Lucasz's popup control can be used even if it is hosted on modal forms(think dialog box which contains your combobox usercontrol).
|
|
|
|
 |
|
 |
Hi
I stumbled across this control when I was writing something similar - its nicely wrapped up - well done!
I do have a question that you might be able to help with. Let's say we have a toolstripmenu with various controls on it and a DropDownButton. How would you display your Popup instead of the existing menu when the DropDownButton is clicked?
Before anyone starts telling me about the Show() method - Its' not as simple as that!
When a toolstripmenu overflows, if a button is clicked, the overflowed portion (that the user must click on first) is hidden immediately afterwards. This is not the case with a DropDownButton - which is why I figured the solution must lie within this control - which is the real issue here!
Any ideas?
Thanks
Gee
Gee
|
|
|
|
 |
|
 |
By overriding the ToolStripDropDown class and using the ToolStripControlHost class, I was able to embed a control in a dropdown 'menu', whilst retaining the expected toolstrip behaviours.
For this scenario, this control is not appropriate - but it is nevertheless a fantastic control and can serve more purposes than being just a tooltip!
Nice work
Gee
|
|
|
|
 |
|
 |
Hi,
You can write for example
toolStripDropDownButton.DropDown = new Popup(new Button()); It works perfectly for me.
Regards,
Łukasz
|
|
|
|
 |
|
 |
I have a textBox, and i want to have a popup form when i press enter key from Textbox, the popup form showed but i can't write anything into the textbox althought it is focused? How can i do it?
Thanks!
|
|
|
|
 |
|
 |
I found that MDIChild Form lost focus after popup showed. Does anybody know how to solve it?
Thanks in advance.
|
|
|
|
 |
|
 |
I have a popup built into one of my systems that has a combo box very close to the bottom of the popup. When the user clicks to select an Item the popup closes without updating the combo. Is there away to stop this from happening.
|
|
|
|
 |
|
 |
Use PopupControl.ComboBox class instead of System.Windows.Forms.ComboBox
|
|
|
|
 |
|
 |
Hi,
Nice article. I want to add a gripper into the toolstrip so that by dragging left-right it, the control left side of the gripper should resize. For best example you can see the google toolbar. there is a gripper at right side of search combobox though which the search combobox can be resized. Please tell me the solution and make email at rizwan_nuces@yahoo.com.
Thanks in advance.
Rizwan
|
|
|
|
 |
|
 |
Hi, I would like my content control to know when it's done popping up, but I can't get the content.Leave event to fire. I've tried various goofy stuff in Popup.OnClosed (like content.Hide(), content.SelectNextControl(...), etc) but no luck. I can't do content.OnLeave(e) since it's protected (doesn't seem like a good idea anyway).
Does anyone have any ideas?
|
|
|
|
 |
|
 |
There are content.Closing and content.Closed events which are fired. You can use them instead of content.Leave event.
|
|
|
|
 |
|
 |
This is an excellent control and I am so glad that I found it. Is there away to open a form from within the popup but not have the popup close.
This functionality would be great for adding items to a combo box.
|
|
|
|
 |
|
 |
You can set AutoClose property to false, but then you have to handle closing by yourself.
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
how it Support .net compact framework ?
|
|
|
|
 |
|
 |
Well, I haven't checked it on .NET CF. But I've looked into MSDN and found out that the ToolStripDropDown class I use is not supported on .NET Compact Framework, so I'm afraid the pop-up control cannot be used with .NET CF.
|
|
|
|
 |
|
 |
First off - great stuff! Incredibly helpful code (appreciate the "Region" tutorial too!).
So, fringe case, but one I'm interested in (for tooltips that exactly overlap my hovered, truncated text, for instance):
In the "more complex" app, drag the form near the bottom of the screen, and hover over the right portion of a grid cell - you can get the popup to appear directly below the mouse cursor. And the dueling begins - the tooltip grabs focus, dataGridView_CellMouseLeave closes the tooltip, the grid gets focus again, shows the tooltip, and the tug-of-war gets ugly.
Any thoughts on a best strategy? TIA, brian
|
|
|
|
 |
|
 |
Well, this "focus dueling" is a bug.
To fix it comment or delete the following lines in the "more complex" app.rect.X += 32;
rect.Y += 32;
Regards,
Łukasz
|
|
|
|
 |