Home » U++ Library support » U++ Widgets - General questions or Mixed problems » ColumnList question (move and delete item)
ColumnList question (move and delete item) [message #2795] |
Tue, 25 April 2006 15:30 ![Go to next message Go to next message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/112.jpg) |
forlano
Messages: 1189 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I had to show data vertically (just one column), then change their relative position and remove when necessary. Instead to use the arrayctrl I wanted to experiment the ColumnList believing that was more appropriate. Now that everything is ready I can't find a method to remove the item and permit their relative motion.
Is there a solution or I must come back to the arraycrtl?
Thank you,
Luigi
[Updated on: Tue, 25 April 2006 15:31] Report message to a moderator
|
|
|
|
Re: ColumnList question (move and delete item) [message #2800 is a reply to message #2798] |
Tue, 25 April 2006 20:26 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/3.png) |
mirek
Messages: 13986 Registered: November 2005
|
Ultimate Member |
|
|
OK, added.
Will be in next release, however, if you really need it now, just add/replace these methods in ColumnList:
void ColumnList::Insert(int ii, const Value& val, bool canselect)
{
Item& m = item.Insert(ii);
int c = -1;
if(cursor >= ii) {
c = cursor + 1;
KillCursor();
}
m.value = val;
m.sel = false;
m.canselect = canselect;
m.display = NULL;
Refresh();
SetSb();
if(c >= 0)
SetCursor(c);
}
void ColumnList::Insert(int ii, const Value& val, const Display& display, bool canselect)
{
Insert(ii, val, canselect);
item[ii].display = &display;
}
void ColumnList::Remove(int ii)
{
int c = -1;
if(cursor >= ii) {
c = max(ii, cursor - 1);
KillCursor();
}
item.Remove(ii);
Refresh();
SetSb();
if(c >= 0)
SetCursor(c);
}
void ColumnList::Add(const Value& val, bool canselect)
{
Insert(item.GetCount(), val, canselect);
}
void ColumnList::Add(const Value& val, const Display& display, bool canselect)
{
Add(val);
item.Top().display = &display;
}
Mirek
|
|
|
|
Goto Forum:
Current Time: Mon Jun 17 18:03:11 CEST 2024
Total time taken to generate the page: 0.02272 seconds
|