|
Feb 24 |
comment |
How to dynamically toggle curves on/off in a crowded Plot? You say The buttonbar above the plot is not a natural interface. Clicking on the curve or legend would be a natural action to toggle a curve's visibility. But in this case, what would the user click on to toggled it back? Hence one needs a button there all the time, like you show above yourself. If one toggles the legend to remove the curve, then there is no where to click any more to bring it back. I see nothing wrong with the way you have it above. It seems very natural. |
|
Feb 24 |
awarded | Nice Question |
|
Feb 24 |
revised |
Distance between point and line segments removed the dashed lines until I figure the angle better. |
|
Feb 24 |
comment |
Distance between point and line segments @MikeZ. Thanks. I forgot the Abs on the distance from the formula in the reference. I will add that now. As for the perpendicular dashed lines, I added that myself. It depends on which side to take the angle with. So I need to look at this more to make it more robust. So, for now, will remove the dashed lines as I do not have time to look at it. But the distances is correct. |
|
Feb 24 |
comment |
Include a CDF file in sites.google did you try this wordpress.org/extend/plugins/wolfram-cdf-plugin |
|
Feb 24 |
accepted | How to make DynamicModule work without an extra ENTER |
|
Feb 24 |
comment |
How to make DynamicModule work without an extra ENTER @SjoerdC.deVries great. Thanks! I got it now. it is all working well now. I am now converting a large demo I did with Manipulate to DynamicModule. DyanmicModule allow more flexibility. Manipulate makes somethings easier to set up but it was hard to do some other thing with it that I wanted to do. I think learning to use DynamicModule is worth it. The only thing is that the objects I am using remain global (the plot object in this example). I wanted them to be local to the DyanmicModule. But that is ok. Same problem was with Manipulate when using this setup actually. can't avoid it. |
|
Feb 24 |
comment |
How to make DynamicModule work without an extra ENTERThis might be surprising considering its name but I think is in agreement with the documentation, which is somewhat vague about these details Would you please have a reference where it says that the body of DynamicModule is evaluated BEFORE the Initialization section? I did actually notice that during one of the many tries (with lots of print statments), but I was baffled by it and thought I was doing something wrong or just a side effect of the print IO. One would expect something called Initialization to be evaluated first thing. But what do I know. |
|
Feb 24 |
comment |
How to make DynamicModule work without an extra ENTER and on the console I see this: plot$1457 and plot$1467. So the plot which is actually being used is the global one (the one at the bottom of the Initialziation section. So your code will work now like this: !Mathematica graphics You see, I removed the local plot from inside DynamicModule, and it still works in CDF now. But using the global plot. But this is OK with me. At least it works. But I just wanted to say I tried this trick, but rejected it too quickly when I saw it is different object than the local plot. Thank you very much. |
|
Feb 24 |
comment |
How to make DynamicModule work without an extra ENTER Thanks Albert. In one of my tried, I did try creating the plot object at the end of the Initialization section (this is what I do when using Manipulate as well). I did not use this, since I saw that plot inside DyanmicModule is not the same global plot used in the Initialization section. When I add Print[plot] at the very top of the DynamicModule, and the botton of the Initialization section, they print different names. Actually if remove the local plot from DynamicModule, your code will still work as is. screen shot: !Mathematica graphics .... |
|
Feb 24 |
comment |
How to make DynamicModule work without an extra ENTER I know basic DynamicModule, even thought I have not used them in demos before. So the basic stuff is covered. I needed to implement the same object based construct I use in Manipulate inside DynamicModule. I posted the most simple case of this construct. It is less than 20 lines or so. I posted the code to get help from experts to see what is wrong with it. I know already it is not working correctly. |
|
Feb 24 |
revised |
Distance between point and line segments added 523 characters in body |
|
Feb 24 |
revised |
Distance between point and line segments added 13 characters in body |
|
Feb 24 |
answered | Distance between point and line segments |
|
Feb 24 |
revised |
How to make DynamicModule work without an extra ENTER added 56 characters in body |
|
Feb 24 |
asked | How to make DynamicModule work without an extra ENTER |
|
Feb 24 |
comment |
Why does the syntax highlighter color a local symbol red inside DynamicModule? Yes, Ive seen that before. Forgot about it. But it would be nice to know WHY. I do not like just to remember rules about a language. There should be logical reason for these rules. Mathematica is full of just rules to remember, but very little logic to explain why things work the way they are, that is why I learn it by trial and error, because many times it is just impossible to reason about why it does what it does. |
|
Feb 24 |
accepted | Why does the syntax highlighter color a local symbol red inside DynamicModule? |
|
Feb 24 |
comment |
Why does the syntax highlighter color a local symbol red inside DynamicModule? @Rojo. I am sorry, I do not see this. I want M to warn me when I do a real error, not just in case I am doing something wrong. I am used to languages where a reference to a variable is bound to the nearest defined one in the scope of that reference. In x=1, this x refers to the x in closest scope, not to the one above it. So a warning is not needed as this is how it is supposed to work. i.e. I am getting a warning for doing something that is correct. I have declared x locally, and referenced this local x. So now when I see a red symbol, I have to find if it real error or not. |
|
Feb 24 |
revised |
Why does the syntax highlighter color a local symbol red inside DynamicModule? updated to use simpler example |