LocatorPane problem
- To: mathgroup at smc.vnet.net
- Subject: [mg78902] LocatorPane problem
- From: "Mariusz Jankowski" <mjankowski at usm.maine.edu>
- Date: Thu, 12 Jul 2007 05:21:34 -0400 (EDT)
- Organization: University of Southern Maine
I just came across the following problem with LocatorPane. This may crash the kernel so save your work prior to reproducing this result. Start the LocatorPane as in any of the examples in the Doc Center. For example, DynamicModule[{}, pts = {{0., 0.}}; LocatorPane[Dynamic[pts], Graphics[{Red, Disk[]}], LocatorAutoCreate -> All]] Delete the single Locator using Alt-Click. Then Click to add one or more Locators. If possible, return the value of pts. Here is my result - note the first element of the list. In[11]:= pts Out[11]= {{-6.27756*10^288, 1.14627*10^-286}, {0.246, 0.44}, {0.344, -0.065}, {-0.096, -0.21}} The first time you click there will be no visible Locator symbol. However, the list of click events/locations will be updated but with an incorrect value (as above). Furthermore, dynamic monitoring of the value of pts during interactive adding/deleting of Locators will kill the kernel at the first click inside and empty pane. I guess there is a problem with zero Locators in LocatorPane. Is this a bug (I think so!), or are we supposed to use the two-argument form of Dynamic to catch this condition? For example DynamicModule[{}, pts = {{0., 0.}}; LocatorPane[Dynamic[pts, If[# == {}, do something, do something else]&], Graphics[{Red, Disk[]}], LocatorAutoCreate -> All]] Thanks for comments/suggestions, Mariusz