HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Icons Drag and Drop  (Read 3303 times)

GM_James

  • General Accounts
  • *
  • Posts: 118
    • View Profile
Icons Drag and Drop
« on: Jan 23, 13, 11:00:57 AM »

I am trying to get Icons working with Drag and Drop.

I've created my own Icon class which inherits from _GUIIcon
I've created my own Icon Container class which inherits from _GUIIconContainer

I then took and created a spell book which has 12 Icon Containers on it. I then added Icons to each of those containers. Now I want to be able to Drag Icons from the Spell book onto our Ability bar which will be lined with Icon Containers. Problem is that Drag and Drop isn't working... any helped would be greatly appreciated!
Logged

Tarra2012

  • General Accounts
  • *
  • Posts: 113
    • View Profile
Re: Icons Drag and Drop
« Reply #1 on: Jan 23, 13, 11:13:56 AM »

I had trouble with drag and drop icons myself. You need two kinds of classes written and extended.

1. IconContainer (Your Slots - parentClass _GUIIconContainer)
2. IconSubjects   (Your Icons - parentClass _IconSubjectInterface)

Overriding in both classes the method "_AllowIconDragAway" will activate drag n drop, Example:

method _AllowIconDragAway(icon as NodeRef of Class _GUIIcon) as Boolean
  return true
.


1 YourITEMContainer  parentClass _GUIIconContainer       must override the method
2 YourITEM                  parentClass _IconSubjectInterface  must override the method



Maybe this or the following discussion helps -->
https://community.heroengine.com/forums/index.php/topic,3793.0.html
Logged

GM_James

  • General Accounts
  • *
  • Posts: 118
    • View Profile
Re: Icons Drag and Drop
« Reply #2 on: Jan 23, 13, 11:46:25 AM »

Thanks so now I have Drag and Drop working. However isInert = true isn't working and setting allowmove to false doesn't prevent the icons from being able to be dragged...
Logged

Tarra2012

  • General Accounts
  • *
  • Posts: 113
    • View Profile
Re: Icons Drag and Drop
« Reply #3 on: Jan 24, 13, 02:41:07 AM »

Two ideas

1. Disable mouseevents / mousetargeting on GUI targets/containers

2. Some properties in hero engine needs to be set before the instancination/activation of an object.
     But i dont know if there are such properties in the Icon Context.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Icons Drag and Drop
« Reply #4 on: Mar 08, 13, 11:19:13 PM »

I have been attempting to follow along and also make some icons for our game. I have made 2 classes, 1 for each part. I set the classes to _GUIIcon and _GUIIconContainer. I built a panel with 4 containers and 4 icons. I have this method "_AllowIconDragAway" in both scripts. I have also seen the other discussion, and followed the wiki. When I tried to change the icon to _IconSubjectInterface, I get the error.

2. IconSubjects   (Your Icons - parentClass _IconSubjectInterface)

!ERROR!System:GUIXMLChomper::CreateControlType attempted to create a control type "TMP_Item" which inherits from "_icon" but its class "TMP_Item" does not inherit from the baseClass "_GUIIcon" of the inherit from prototype.

Would you have any more details, such as which inherit from in the create new GUI?
Logged

TheRabid

  • General Accounts
  • *
  • Posts: 41
    • View Profile
Re: Icons Drag and Drop
« Reply #5 on: Sep 21, 13, 07:26:51 PM »

Sorry to bump this old topic, but I have a question exactly like Thazager here and was wondering if any one has figured this out?


Would love some insight on this from any one.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Icons Drag and Drop
« Reply #6 on: Sep 21, 13, 07:59:38 PM »

I have changed our system from the drag-and-drop to pick-up and put-down. The reason falls partly from my mouse having problems, and it double clicks at times. This would never work for me with a drag-and-drop system. I follow something more along the lines with the Dev tutorial about items, that you can pick them up and then drop them down. https://community.heroengine.com/forums/index.php/topic,4364.0.html While it does say "DragNDrop" its really uses the pick-up and put-down.
Logged

Tarra2012

  • General Accounts
  • *
  • Posts: 113
    • View Profile
Re: Icons Drag and Drop
« Reply #7 on: Nov 09, 13, 06:39:48 AM »

Dont use "inherit". Neither in Class nor in GUI Prototype.
Use "parent classes" and overwrite any needed methods.
This eliminates a lot of error sources.

Logged