Game Development Community

Stop changing parent when dragging control in the gui editor

by Ian Omroth Hardingham · in Technical Issues · 11/25/2013 (4:20 am) · 8 replies

Hey guys.

I wish to disable the feature in the gui editor which causes the parent of the dragging control to change.

Thanks,
Ian

#1
11/25/2013 (11:00 pm)
Would help if you had given us a clue as to which engine you're using by posting in the relative engine forums or at least told us...
#2
11/26/2013 (3:17 am)
Ah, my apologies.

This is Torque3D 1.2.

Ian
#3
11/26/2013 (6:48 am)
I'm not sure why you would want that - what issue is it causing? I'm pretty sure there is a reason for it.

And having said that, you can find the GUI Editor scripts in <project>/game/tools/guiEditor....
#4
11/27/2013 (4:01 am)
This behaviour is controlled in GuiEditCtrl::onMouseDragged, specifically:

// if the control under the mouse is not our parent, move the selected controls
      // into the new parent.
      if(mSelectedControls[0]->getParent() != inCtrl && inCtrl->mIsContainer)
      {
         moveSelectionToCtrl( inCtrl, mDragMoveUndo );
         setCurrentAddSet( inCtrl, false );
      }

IMO I'd probably add an extra conditional here (e.g. "event.modifier & SI_RSHIFT") to disable it, otherwise weird and annoying things can start to happen if its disabled all the time.
#5
11/27/2013 (5:43 am)
Yeah, you could probably end up with controls behind others, among other things. They are "z-sorted" by the order they appear in the gui file, after all....
#6
11/27/2013 (5:55 am)
Many thanks for being helpful James.

Richard, thank you for telling me I shouldn't want what I want and then pointing me to some random cs file and then implying that I can't deal with "controls behind controls".

If you see any other posts by me here I'd appreciate it if you didn't answer them.

Thanks,
Ian
#7
11/27/2013 (6:30 am)
Watch out for any rogue controls that end up without a parent while you are dragging. The root control is usually that empty space in the editor. If what you are dragging does not end up under any controls in your inspector, it will not get saved. Double check your save file before you close.
#8
11/28/2013 (10:13 am)
Someone didn't get their coffee?

I wasn't "implying," just mentioning. I wasn't telling you that you shouldn't want what you want, I was saying that I don't understand why you want it. I didn't point you at a "random cs file" - I pointed you to the GUI Editor scripts, you know, where the GUI Editor is implemented.

I suppose if the only answer you find acceptable is a near-complete solution for your use case you could try giving the complete use case so that people could be more specific in their answers. The "what" and "why" are important to a complete, robust solution.

You are welcome to be offended.