|
|
Home » Developing U++ » UppHub » PopEasy
PopEasy [message #36489] |
Fri, 01 June 2012 16:33  |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
I am working on a small utility that may help make Popup easier in many situations.
It seeks to handle some situations which DropChoice, DropTree and DropGrid either don't take care of or can not be used in with ease.
It aims to support auto-popup, auto-select, and auto-completion. Attached example shows auto-popup and auto-select. auto-completion is not currently supported. I am still debating on the mechanism to communicate auto-completion information from the popup to the owner (or main) ctrl.
For an brief idea of what PopEasy is, please try attached example. It's still very primitive, but please feel free to give your input.
Some concrete PopUp class similar to DropTree and DropChoice will be added for convenience. They are not currently present though.
Thanks,
Lance
[Updated on: Sun, 03 June 2012 03:19] Report message to a moderator
|
|
|
|
Re: PopEasy [message #36496 is a reply to message #36494] |
Sat, 02 June 2012 19:51   |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
Hello Lance,
I have do same thing similar in an old project
to facilitate the work, I propose to add an EditField in the same window as the ArrayCtrl.
zip attached explain my proposal.
Regards
Omari.
regards
omari.
|
|
|
|
Re: PopEasy [message #36498 is a reply to message #36497] |
Sun, 03 June 2012 01:28   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Hi Koldo:
it's in CtrlCore.h
public:
enum StateReason {
FOCUS = 10,
ACTIVATE = 11,
DEACTIVATE = 12,
SHOW = 13,
ENABLE = 14,
EDITABLE = 15,
OPEN = 16,
CLOSE = 17,
POSITION = 100,
LAYOUTPOS = 101,
};
Not sure if it's because of a namespace issue. I'll do a test compilation in Ubuntu in a while. WithPopUp<> inherits from Ctrl or its derivative, so POSITION should be visible to it. Anyway, it use explicit Ctrl::POSITION or Ctrl:::StateReason::POSITION silence the compiler, please let me know.
|
|
|
|
|
Re: PopEasy [message #36512 is a reply to message #36500] |
Sun, 03 June 2012 22:56   |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
Main motivation:
In database application, a typical requirement we frequently have is some kind of Ctrl (or group of Ctrls) that do key-value conversion. Eg, you (or users of your application) will key in some text in certain area intended for an inventory item, and your application can search database in whatever way you decided for all matching inventory items; these items are subsequently presented to user. He/she may select one either with key stroke or mouse, or he/she may keep on typing until the list is short enough. And when a choice is finally made, a user friendly text will be displayed and the associated iventory item id (of integral type) is be provided to the application for subseqent processing.
DropGrid with search-hide-row is a closest match. I have been using it extensively. DropGrid, however, like DropChoice, DropTree, will own the keyboard focus in its session. This make editing not always as natural as we would like. For example, I need to do some interesting things with all inventory items containing "fatastic", one at a time. Let's say I have 10 items containing this text. With DropGrid, I need to key in "fatasic" for 10 times. Why couldn't I just type it once, copy it in the clipboard, and paste it for the subsequent 9 times? I might be wrong in DropGrid's not accepting Ctrl-V, but you'll definitely find situations you would rather work with a real edit ctrl, be it EditField derivative, EditLine, or RichEdit.
For that purpose, the popup should not take focus away from the main ctrl (the ctrl the popup will work for. In Ctrl::PopUp(...), it's called the *owner*). I did some experiment, and fixed some issue associated with that.
One of it happens when the main window is resized or moved. Resize'ing or move'ing will not trigger main's lost-focus event, we end up have a popup detached from its owner. BTW, theide's CodeCompletion, which is the best among the open-source ones (second only to Visual Studio and possibly a couple of other commercial ides), uses the same approach that would-be PopEasy uses: a non-focus popup with the focused editor. Theide's popup will no respond to size/move. If you bring up a PopUp and then resize or move theide, you'll found the popup detached from the location it's giving options for. Anyway, after some research, I find it can be handled nicely with UPP's built-in capability: just use the State virtual method.
Another issue I encountered is a visibility issue. I use TabBarCtrl to provide a multi-tab user interface similar to FireFox. If I bring up a popup for a ctrl and switch to another tab, the popup becomes detached and clueless as its owner remains focused and doesn't have a size/position change. To fix this issue, I decide to unpop the popup when its owner becomes invisible. This is a very dubious decision because it prohibits the popup from covering its owner which is theoretically wrong. But for now, it doesn't seem to be so much a problem and promises an easy fix.
[Updated on: Sun, 03 June 2012 23:23] Report message to a moderator
|
|
|
|
|
|
|
|
Re: PopEasy [message #36548 is a reply to message #36545] |
Thu, 07 June 2012 04:48  |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
GCC hates Ctrl::StateReason::POSITION. All compilers prefer Ctrl::POSITION.
Backspace to remove the auto-completed suffix could be a good feature.
Fixed these two. The latter for PopList only though.
|
|
|
Goto Forum:
Current Time: Fri May 09 17:57:35 CEST 2025
Total time taken to generate the page: 0.02206 seconds
|
|
|