|
|
Home » Developing U++ » UppHub » MultiList
|
Re: MultiList [message #15985 is a reply to message #15978] |
Wed, 21 May 2008 18:08   |
|
Very nice! If it offers all ColumnList functionality maybe we could replace the oryginal version and add class ColumnList : MultiList(LIST_MODE)?
|
|
|
Re: MultiList [message #15986 is a reply to message #15985] |
Wed, 21 May 2008 18:28   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
There's no reason why not (except for the DropInsert function that take a ColumnList parameter, but that's easily removed). The extra features are implemented by switch statements in various places, so 99% of the code is the same and the performance hit should be negligible.
Actually, there is one other thing that could perhaps cause a problem. A ColumnList inheriting from MultiList should probably overload Get/SetData so as not to change serialization.
[Updated on: Wed, 21 May 2008 18:33] Report message to a moderator
|
|
|
|
Re: MultiList [message #17099 is a reply to message #16000] |
Mon, 28 July 2008 23:59   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi James!
I have been using your control for over a month now and I must say that it has served me well.
I recommend that we make sure it is compatible with ColumnList (like Uno said) and we iron out some small issues, I recommend we merge this into CtrlLib and replace ColumnList.
And speaking about issues, there is a small thing that I find quite annoying. When using a control in row mode with a lot of items, if you scroll a lot down and click on an item, when that item is focused, the scroll position is slightly altered. Only the first time. If it did this every time maybe I wouldn't find it annoying . You can see this in the example you provided.
Here is a possible solution:
void MultiList::PointDown(Point p) {
int i = GetItem(p);
bool b = false;
if (p.y < cy || p.y > GetSize().cy - cy)
b = true;
if(i >= 0 && i < GetCount())
SetCursor0(i, false, b);
else
if(clickkill)
KillCursor();
}
void MultiList::SetCursor0(int c, bool sel, bool scroll)
{
int c0 = cursor;
c = minmax(c, 0, GetCount() - 1);
if(c < 0 || cursor < 0)
Refresh();
else
RefreshCursor();
cursor = c;
int q = sb;
if (scroll)
ScrollInto(cursor);
if(q != sb)
Refresh();
else
RefreshCursor();
if(sel && multi) {
ClearSelection();
if(cursor >= 0) {
SelectOne(cursor, true);
anchor = cursor;
}
}
if(c0 != cursor) {
if(cursor >= 0)
WhenEnterItem();
else
WhenKillCursor();
WhenSel();
}
SyncInfo();
Action();
}
void MultiList::SetCursor(int c)
{
SetCursor0(c, true, false);
}
void SetCursor0(int c, bool sel, bool scroll = true);
|
|
|
|
|
|
Re: MultiList [message #17134 is a reply to message #17128] |
Wed, 30 July 2008 12:59   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Having looked at it I've realised that the problem was originally caused by me misunderstanding how the ScrollBar worked and was trying to do something complicated where it wasn't needed. (I was trying to get smoother scrolling, and didn't realise that ScrollBar scales the scroll speed based on it's range - and I had a very large range)
So the previous fix is unneccessary, and now I think everything works perfectly
[Updated on: Wed, 30 July 2008 13:04] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 04:24:34 CEST 2025
Total time taken to generate the page: 0.01238 seconds
|
|
|