Drag and Drop in CEGUI?

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Psih
Just popping in
Just popping in
Posts: 2
Joined: Thu Jun 30, 2005 09:13
Contact:

Drag and Drop in CEGUI?

Postby Psih » Thu Jun 30, 2005 09:45

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 :oops: . Thanks.

User avatar
J_A_X
Quite a regular
Quite a regular
Posts: 72
Joined: Wed Jun 29, 2005 13:18
Contact:

Re: Drag and Drop in CEGUI?

Postby J_A_X » Thu Jun 30, 2005 20:48

the new version now has that option, have fun.

User avatar
Psih
Just popping in
Just popping in
Posts: 2
Joined: Thu Jun 30, 2005 09:13
Contact:

Re: Drag and Drop in CEGUI?

Postby Psih » Fri Jul 01, 2005 09:01

:D 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?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Drag and Drop in CEGUI?

Postby CrazyEddie » Fri Jul 01, 2005 09:13

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.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: Drag and Drop in CEGUI?

Postby Van » Thu Sep 22, 2005 18:04

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?

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Re: Drag and Drop in CEGUI?

Postby martignasse » Fri Sep 23, 2005 21:44

not tested, but by reading what CE wrote

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

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Re: Drag and Drop in CEGUI?

Postby martignasse » Sat Sep 24, 2005 09:53

...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.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: Drag and Drop in CEGUI?

Postby Van » Sat Sep 24, 2005 15:58

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].

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: Drag and Drop in CEGUI?

Postby Van » Sat Sep 24, 2005 23:48

(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... :x
Please stop automatically logging me out of the forums!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Drag and Drop in CEGUI?

Postby CrazyEddie » Sun Sep 25, 2005 09:18

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.

User avatar
vinnythetrue
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Aug 10, 2005 10:29

Re: Drag and Drop in CEGUI?

Postby vinnythetrue » Thu Dec 15, 2005 16:59

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 ?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Drag and Drop in CEGUI?

Postby lindquist » Fri Dec 16, 2005 00:53

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.

User avatar
vinnythetrue
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Aug 10, 2005 10:29

Re: Drag and Drop in CEGUI?

Postby vinnythetrue » Fri Dec 16, 2005 10:38

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...

bitten
Just popping in
Just popping in
Posts: 7
Joined: Mon Jul 31, 2006 15:47

Postby bitten » Fri Aug 04, 2006 12:52

Where I can find some example of drag/drop with CEGUI?

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Aug 04, 2006 13:34

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 :wink:


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 12 guests