Jump to content
Sign in to follow this  
Clayman

Dialog / Listbox help

Recommended Posts

When dragging an listbox element, is there any way to find out what index the dragged element has?

WIKI says onLBDrag should return the index, but it seems to only return the control of the listbox and the text/data/value array of the item.

Also, when dragging, the element is not selected, so lbCurSel doesn't work either.

Second question:

onLBDrop returns x & y coordinates. Is there a way to convert them to an index, so that the droped element is added in the same position where it is droped?

Hmm, maybe I should explain what I'm trying to do.^^

I have two listboxes. When dragging an element from LB 1 to LB 2, I want the element to be added to LB 2. (works)

When dragging an element from LB 2 to LB 1, I want to remove that element from LB2. For this I need to know the index of the dragged element.

And finally I want to be able to sort the elements in LB 2 by dragging them to another position inside LB 2.

Hope there is someone out there who can understand my problem(s) :D and point me in the right direction.

Share this post


Link to post
Share on other sites

What about a button below the list that when you click it will do what you want (take the selected element from the first list and add it in the second list)

Share this post


Link to post
Share on other sites

It is easy to encode the index of the dragged element within the value/data-section.

This should solve your first question.

To the second:

Not possible from my knowledge

Share this post


Link to post
Share on other sites

Hi,

Would you be kind enough to post your listbox definition in description.ext

Thanks in advance

Cheers

Share this post


Link to post
Share on other sites

@d3nn16

With a button it all works without problems. But I wanted to do it the nicer way via drag & drop.

@i0n0s

Thanks for the suggestion. The problem is I'm already using text, data and value for other things.

But maybe I can compare the data of the dragged element with the ones in the listbox, and select the matching one. Will try it out later.

@AliMag

class RscLB_C
{
style = ST_LEFT;
idc = -1;
colorBackground[] = {0,0,0,1};
colorSelect[] = {0,0,0,1};
colorSelectBackground[] = {1,0,0,1};
colorText[] = {1,0,0,1};
colorScrollbar[] = {0,0,0,1};
period = 1;
font = DEFAULTFONT;
sizeEx = 0.029;
rowHeight = 0.04;
soundSelect[] = {"",0.1,1};
soundExpand[] = {"",0.1,1};
soundCollapse[] = {"",0.1,1};
maxHistoryDelay = 10;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
};
class RscListBox: RscLB_C
{
type = CT_LISTBOX;
class ScrollBar
{
	color[] = {0,0,0,1};
	colorActive[] = {1,0,0,1};
	colorDisabled[] = {0.35,0.35,0.35,1};
	thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa";
	arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa";
	arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa";
	border = "\ca\ui\data\ui_border_scroll_ca.paa";
};
};

Share this post


Link to post
Share on other sites

Hi,

A list is managed in two dimension arrangement as one method.

Let the head of the arrangement of each element be an index number.

[[0,data0],[1,data1],[2,data2]]

If the head of each element is referred to, it can treat as an index of the list.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×