I am having all kinds of trouble trying to get the following to work in Mathematica. I want to be able to have, say, icons on the left side of a graphic, and to be able to drag copies of that icon out from the side, like it's a tool palette or something. I've tried using various things like locators, and/or buttons, and/or mouseovers, I can't get anything to work how I've described. LocatorPane with the option LocatorAutoCreate set to "All" is almost what I want, if only I could set it so that it only creates new icons when I click on a stationary version of that Icon. As it is, you can't set a location for LocationAutoCreate to turn on or off apparently.

Here's something I tried, but It's not working 1) the extra locators aren't showing up and I'm not sure why yet and 2) with LocatorPane even if i fixed 1, the locator jumps automatically to where I click and I can't seem to figure out a way to turn that off. I tried making my own version of LocatorPane for a while before throwing my hands up a bit and figuring there must just be something I'm missing here...

Some code that is not working:

   DynamicModule[{p = {}}, {LocatorPane[
     CurrentValue["MouseButtonTest"] && MouseAnnotation[] == 1, 
     AppendTo[p, MousePosition[]]]; 
    Framed@Graphics[{Annotation[Disk[{0, 0}, .03], 1, "Mouse"], 
       Locator /@ p}, PlotRange -> 2]]], 
  Dynamic[{CurrentValue["MouseButtonTest"], MouseAnnotation[], p}]}]


  • $\begingroup$ I'm not sure what you ask is possible. Even if it is, I think it would be very difficult to implement. In support of this position, I would point out that not even the front-end's built-in graphics tool palette supports drag-and-drop. $\endgroup$ – m_goldberg Sep 19 '18 at 10:35
  • $\begingroup$ Unfortunately Mathematica does not support any drag and drop functionality. $\endgroup$ – M.R. Sep 20 '18 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.