Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.4K Views
|
2 Replies
|
1 Total Like
View groups...
Share
Share this post:
GROUPS:

Dynamic Module (book Paul Wellin - prog with Mathematica)

Posted 11 years ago
Attachments:
POSTED BY: Chiel Geeraert
2 Replies
Posted 11 years ago

Yes , thank you for your answer. You are right, I still don't understand the finer workings of 'Dynamic Module' Best Regards, Chiel Geeraert

POSTED BY: Chiel Geeraert

First make sure you understand Module before using DynamicModule. Once you understand Module, understanding DynamicModule can thought of as a version of module that works with Dynamic.

The first argument to Module are the variables to be localized You'll also probably want to initialize them.

DynamicModule[{coordinaten = {}, kortsteTourIndex = {} , kortsteTour = {}},

If you run into a problem like this, first try solving a simpler version of the problem. The example below shows an Interface that records the points you click on it:

DynamicModule[{coords = {}},
 Dynamic@EventHandler[
   Graphics[{Point[coords], Line[coords]}, PlotRange -> {{-1, 1}, {-1, 1}}],
   {"MouseClicked" :>  (Print[coords]; AppendTo[coords, MousePosition["Graphics"]])}
   ]]

For this kind of interface, you might also consider using ClickPane.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard