Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » MultiList
MultiList [message #15978] Wed, 21 May 2008 12:54 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
MultiList is a modified and extended version of the ColumnList ctrl. The additions are:

Key/Value support. Items can be retrieved/set by key, and support for GetData is now present. Not too clever at the moment, there is no indexing so it's a brute-force search.

3 display modes:
ListMode() - Identical to ColumnList (items arranged by column, single item scrolling)
ColumnMode() - Identical except that scrolling is horizontal and scrolls whole columns instead of single items
RowMode() - Items arrange by row, column count is dynamically determined based on ctrl size (you must call SetItemWidth() though). Vertical smoother scrolling.

The package is in the SVN repos., along with the following example:
index.php?t=getfile&id=1216&private=0

James
  • Attachment: MultiList.png
    (Size: 40.73KB, Downloaded 1223 times)
Re: MultiList [message #15985 is a reply to message #15978] Wed, 21 May 2008 18:08 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

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 Go to previous messageGo to next message
mrjt is currently offline  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 #16000 is a reply to message #15986] Thu, 22 May 2008 11:52 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Very nice indeed! Something simple but yet very useful!
Re: MultiList [message #17099 is a reply to message #16000] Mon, 28 July 2008 23:59 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
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 Smile. 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 #17102 is a reply to message #17099] Tue, 29 July 2008 00:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I agree.

I would only wait week or two - in that time-frame we will hopefully finally switch to svn. And James will get rights to maintain this Smile

Mirek
Re: MultiList [message #17119 is a reply to message #17102] Tue, 29 July 2008 17:25 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Rights - or Responsibility? Razz

cbporter:
Thanks for the fix! I've also fixed a bug in Serialization that I still haven't uploaded, as it's on my other machine. I'll combine the two and commit it to the SVN when I'm allowed.
Re: MultiList [message #17128 is a reply to message #17119] Tue, 29 July 2008 23:14 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Unfortunately my fix messed up the scrolling when using the keyboard to navigate the control. Sorry that I didn't notice yesterday. This can be fixed easily in Key, but before that I need to understand how exactly does the shift multiselecting work. I don't think it works right, or at least not as I expect it. After I shift select a range, I can freely select other items without invalidating my previous selection, basically leaving me with a range selection and a single item selection. I never saw such selection model before. Is this intentional?
Re: MultiList [message #17134 is a reply to message #17128] Wed, 30 July 2008 12:59 Go to previous messageGo to next message
mrjt is currently offline  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 Smile

[Updated on: Wed, 30 July 2008 13:04]

Report message to a moderator

Re: MultiList [message #17137 is a reply to message #17134] Wed, 30 July 2008 19:38 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Yes, it even fixed some other "wacky" behavior when clicking on a region which did not contain any items.
Re: MultiList [message #20339 is a reply to message #17137] Thu, 12 March 2009 15:06 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Sorry to bring this up again, but is the merger of MultiList with ColumnList still on the list of thing that will be done?
Re: MultiList [message #20413 is a reply to message #15978] Tue, 17 March 2009 14:14 Go to previous messageGo to next message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
It would be nice to add ColumnMode() to FileSel too.

cocob
Re: MultiList [message #20414 is a reply to message #20339] Tue, 17 March 2009 17:09 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
cbpporter wrote on Thu, 12 March 2009 14:06

Sorry to bring this up again, but is the merger of MultiList with ColumnList still on the list of thing that will be done?



cbpporter


It would be nice to add ColumnMode() to FileSel too.


All it takes is for Mirek to move it to Uppsrc.
Re: MultiList [message #21045 is a reply to message #20414] Tue, 28 April 2009 13:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Tue, 17 March 2009 12:09

cbpporter wrote on Thu, 12 March 2009 14:06

Sorry to bring this up again, but is the merger of MultiList with ColumnList still on the list of thing that will be done?



cbpporter


It would be nice to add ColumnMode() to FileSel too.


All it takes is for Mirek to move it to Uppsrc.


Merged.

I have done some subtle changes, the most significant one is removing "max" check in ItemHeight/ItemWidth.

Mirek
Re: MultiList [message #21046 is a reply to message #21045] Tue, 28 April 2009 14:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
luzr wrote on Tue, 28 April 2009 07:45

mrjt wrote on Tue, 17 March 2009 12:09

cbpporter wrote on Thu, 12 March 2009 14:06

Sorry to bring this up again, but is the merger of MultiList with ColumnList still on the list of thing that will be done?



cbpporter


It would be nice to add ColumnMode() to FileSel too.


All it takes is for Mirek to move it to Uppsrc.


Merged.

I have done some subtle changes, the most significant one is removing "max" check in ItemHeight/ItemWidth.

Mirek


One less subtle change:

Removed error-prone ColumnList::Serialize (and the old one is now SerializeSettings to avoid confusion).

It caused pretty bad things to theide...

Mirek
Re: MultiList [message #21047 is a reply to message #21046] Tue, 28 April 2009 14:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, another nonsubtle change: I have made ListMode default...

Mirek
Re: MultiList [message #21632 is a reply to message #21047] Sat, 30 May 2009 10:18 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Thank you!

I have removed MultiList everywhere and replaced it with ColumnList and no issues encountered, except the small first time scroll jump bug.

cbpporter Issue #018: MultiList merged with ColumnList
Fixed.
Re: MultiList [message #35093 is a reply to message #21632] Wed, 11 January 2012 10:38 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello cbpporter

Now there is a MultiListExample. Should it be removed?


Best regards
Iñaki
Re: MultiList [message #35097 is a reply to message #35093] Wed, 11 January 2012 11:34 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Hi koldo!

As far as I know, the two controls have been merged a long time ago. There is no longer a separate MultiList control. MultiListExample thus no longer compiles.

Please correct me if I'm wrong.
Re: MultiList [message #35100 is a reply to message #35097] Wed, 11 January 2012 12:59 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello cbpporter

Yes, it seems Bazaar/MultiListExample is now useless and it should be removed.

However I did not know if you or mrjt would have to remove it.


Best regards
Iñaki
Previous Topic: Scatter malfunction du to ImageDraw bug ??
Next Topic: WithAutoChoice
Goto Forum:
  


Current Time: Fri Mar 29 12:16:06 CET 2024

Total time taken to generate the page: 0.01763 seconds