# Floating toolbar/component dragging problem

**URL:** <https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764>\
**Category:** General JUCE discussion\
**Created:** [April 23, 2008, 10:12am UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764 "2008-04-23T10:12:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [April 23, 2008, 10:12am UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764/1 "2008-04-23T10:12:41Z")

</div>

I’ve create a component in jucer, a simple toolbat with 3 imageButtons and one static image, gave it static size.

now i have a component inside a tabbedComponent (the tab component is a window in a multidocument component), that adds this juce-created component and set’s it alwaysOnTob, within the toolbar i made the ComponentDragger accoring to the juce API manual, just one problem, when i do:

```auto
void CtrlrEditorFloatToolbar::mouseDown (const MouseEvent& e)
{
	myDragger.dragComponent (this, e);
}
```

the component disappears, and re-appears wheen resize() is called or when i change to some other tab and back. it just fades away, dunno why, its pure JUCER created no other calls of my own.

---

<div class="post-metadata">

**Author:** ![jsolo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jsolo/32/30_2.png) [@jsolo](https://forum.juce.com/u/jsolo)\
**Post date:** [April 23, 2008, 11:21am UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764/2 "2008-04-23T11:21:46Z")

</div>

```auto

Should be in mouseDrag to do the drag.

and

[code]myDragger.startDraggingComponent(this,0);[/code]

Should be placed in mouseDown so that the dragger can get the Component' original location first.

Hope that fixes it.
```

Should be in mouseDrag to do the drag.

and

```auto

```

Should be placed in mouseDown so that the dragger can get the Component’ original location first.

Hope that fixes it.

---

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [April 23, 2008, 12:48pm UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764/3 "2008-04-23T12:48:25Z")

</div>

i have both:

```auto
void CtrlrEditorFloatToolbar::mouseDrag (const MouseEvent& e)
{
	myDragger.startDraggingComponent (this, 0);
}

void CtrlrEditorFloatToolbar::mouseDown (const MouseEvent& e)
{
	myDragger.dragComponent (this, e);
}
```

myDragger is defined as a private member ComponentDragger myDragger;

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 23, 2008, 2:53pm UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764/4 "2008-04-23T14:53:43Z")

</div>

hmm… try 'em the other way round…

---

<div class="post-metadata">

**Author:** ![atom](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/atom/32/113_2.png) [@atom](https://forum.juce.com/u/atom)\
**Post date:** [April 23, 2008, 7:12pm UTC](https://forum.juce.com/t/floating-toolbar-component-dragging-problem/2764/5 "2008-04-23T19:12:05Z")

</div>

OMG i’m sorry i missed that 🙂  
ofcourse.
