Drag and Drop in CEGUI?
Moderators: CEGUI MVP, CEGUI Team
Drag and Drop in CEGUI?
I want to make an inventory such as in Diablo,Diablo2.
But i have never seen Drag&Drop in CEGUI. Can i do this with CEGUI? and how? (I use CEGUI with OGRE 1.0.2) May be some code wich show Drag&Drop in CEGUI will help me.
PS: sory for my english . Thanks.
But i have never seen Drag&Drop in CEGUI. Can i do this with CEGUI? and how? (I use CEGUI with OGRE 1.0.2) May be some code wich show Drag&Drop in CEGUI will help me.
PS: sory for my english . Thanks.
Re: Drag and Drop in CEGUI?
the new version now has that option, have fun.
Re: Drag and Drop in CEGUI?
Thanks!
I have download this wersion last night. Now will try howe it work.
Somebody have some code wich show how work with Drag and Drop?
I have download this wersion last night. Now will try howe it work.
Somebody have some code wich show how work with Drag and Drop?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Drag and Drop in CEGUI?
As stated, Drag & Drop is in the new 0.3.0 release.
Basically, you add whatever content you need to a DragContainer, and listen for DragDrop related events on possible target windows; you then decide what to do based upon the events you get.
I have no time to produce any sample code at present, though A wiki tutorial may be on the cards in a couple of weeks
CE.
Basically, you add whatever content you need to a DragContainer, and listen for DragDrop related events on possible target windows; you then decide what to do based upon the events you get.
I have no time to produce any sample code at present, though A wiki tutorial may be on the cards in a couple of weeks
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Drag and Drop in CEGUI?
I have no time to produce any sample code at present, though A wiki tutorial may be on the cards in a couple of weeks ;)
CE.
*bumps CE* ;)
Would someone please give a quick overview (here or the Wiki) of what needs to be done to implement a Drag-N-Drop? There are no examples or even code snippets to review.
I see the CEGUI::DataContainer but what is the CEGUI::DragContainerFactory for?
What is the order of creation? Does everything related to a drag-drop have to be in a container? How do you define a draggable item? How do you define a receiver?
- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Drag and Drop in CEGUI?
not tested, but by reading what CE wrote
Maybe you can try :
1°/
you define a draggable item by making it a child of a "DragContainer".
2°/
you make the item you want to be the receiver listening to "DragDrop" events to be informed when the drag and drop action is done on him.
hope it helps
Basically, you add whatever content you need to a DragContainer, and listen for DragDrop related events on possible target windows; you then decide what to do based upon the events you get.
Maybe you can try :
1°/
you define a draggable item by making it a child of a "DragContainer".
2°/
you make the item you want to be the receiver listening to "DragDrop" events to be informed when the drag and drop action is done on him.
hope it helps
- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Drag and Drop in CEGUI?
...and another idea,
example should be found in CEGUI itself because the MultiColumnList implement it.
try to search in CEGUI source code, in the MultiColumnList implementation.
example should be found in CEGUI itself because the MultiColumnList implement it.
try to search in CEGUI source code, in the MultiColumnList implementation.
Re: Drag and Drop in CEGUI?
martignasse wrote:
...and another idea,
example should be found in CEGUI itself because the MultiColumnList implement it.
try to search in CEGUI source code, in the MultiColumnList implementation.
I must be blind as a bat.. I searched the entire CEGUI solution and I couldn't find an example of where DragContainer is really being implemented (except in the LUA stuff and I am not to sure what's going on there). I have this MultiColumnListBox with rows. I want to be able to drag and drop the row(s) from one window to another. Do I need to create only ONE container for the drag and drop? Or, do I need to create a container for each row in each MultiColumnListbox?
This doesn't work:
Code: Select all
char mStr[128];
sprintf(mStr, "Inventory/DragContainer/%s", c1);
CEGUI::DragContainer *mDC = (CEGUI::DragContainer *)mWinMgr->createWindow(
"DragContainer", (CEGUI::utf8*)mStr);
unsigned int mRow = mListBox->addRow();
CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem((CEGUI::utf8*)c1, 0);
mListBox->setItem(item, 0, mRow);
mDC->addChildWindow(item);
Note the line [color=0000FF]mDC->addChildWindow(item);[/color].
Re: Drag and Drop in CEGUI?
(CEGUI Version 0.4.0) Well, after studying the code it has become painfully obvious that Drag and Drop is not supported at the ListBoxItem level(s) - yet. It is only supported at the Window widget level. I can't figure out a way to be able to drag and frop ListBoxItems. Back to the drawing board...
Please stop automatically logging me out of the forums!
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Drag and Drop in CEGUI?
Nobody ever said that this was supported for listbox items.
It's a pretty simple customisation to add, actually You could use a similar approach to Blackharaz when he added per-item tooltips to the standard Listbox.
It's a pretty simple customisation to add, actually You could use a similar approach to Blackharaz when he added per-item tooltips to the standard Listbox.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- vinnythetrue
- Not too shy to talk
- Posts: 21
- Joined: Wed Aug 10, 2005 10:29
Re: Drag and Drop in CEGUI?
I too, am trying to use this DragContainer, without any success so far...
Actually, I made allmost (quite buggy) what I want, but in a really dirty way.
So, what I want is simply to be able to drag the buttons from one location to another in a button grid. The buttons are active, meaning you can click them anytime. So I just wanted to add the drag stuff.
So what I did is replace each button of the grid with a DragContainer containing the button. But I rapidly realized that the dragcontainer seems only useable when the really clicked widget is disabled....
I came out with something approaching by simply recoding the mousedown/mousemove/mouseup code in the button handlers. So when MY code detects willing to drag, I just disable the button and then inject some ButtonUp and ButtonDown inputs in the system, quite ugly heh ?
So far I just can't see better way of doing what I want, so, where am I wrong ?
Actually, I made allmost (quite buggy) what I want, but in a really dirty way.
So, what I want is simply to be able to drag the buttons from one location to another in a button grid. The buttons are active, meaning you can click them anytime. So I just wanted to add the drag stuff.
So what I did is replace each button of the grid with a DragContainer containing the button. But I rapidly realized that the dragcontainer seems only useable when the really clicked widget is disabled....
I came out with something approaching by simply recoding the mousedown/mousemove/mouseup code in the button handlers. So when MY code detects willing to drag, I just disable the button and then inject some ButtonUp and ButtonDown inputs in the system, quite ugly heh ?
So far I just can't see better way of doing what I want, so, where am I wrong ?
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: Drag and Drop in CEGUI?
there is no easy way to overcome this problem currently. thing is that you cannot stop the button from consuming the events...
I would stick to your current approach.
I would stick to your current approach.
- vinnythetrue
- Not too shy to talk
- Posts: 21
- Joined: Wed Aug 10, 2005 10:29
Re: Drag and Drop in CEGUI?
That's too bad
So I'll probably try to code something myself when I'll have time, this ugly solution isn't really satisfying, the drag doesn't work each time (mostly when the mouse movement is really fast).
The point is that I don't really understand why the drag comportment is not part of the window object (with some flag to activate/desactivate it), it doesn't seem very natural to only drag disabled widgets...
So I'll probably try to code something myself when I'll have time, this ugly solution isn't really satisfying, the drag doesn't work each time (mostly when the mouse movement is really fast).
The point is that I don't really understand why the drag comportment is not part of the window object (with some flag to activate/desactivate it), it doesn't seem very natural to only drag disabled widgets...
My approach to Cegui so far has been that when I needed something I looked for a way (sample, tutorial) to do it, didn't find it, spent hours and hours figuring it out, debugging it, and finally writing up a Wiki for what I had discovered so that others would (hopefully) have an easier time.
I will need drag and drop eventually. But maybe your need is greater, more immediate than mine and you'll beat me to that Wiki write up
I will need drag and drop eventually. But maybe your need is greater, more immediate than mine and you'll beat me to that Wiki write up
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 1 guest