>>>>> "Jason" == Jason Bertsche <[email protected]> writes:
Jason> There's no way to do it from NetLogo code out of the box. Jason> However, it shouldn't be terribly difficult to make an extension Jason> with primitives for this. Once you have a handle on the Jason> `ButtonWidget` object (let's say that you've placed this widget Jason> objecct into a variable called "button"), you should be able to Jason> do `button.foreverOn = true` or `button.foreverOn = false` Jason> within the extension code at will in order to change whether or Jason> not the forever button is engaged. As always in any Swing application, remember to switch to the AWT event thread, through, before doing anything in your extension that touches GUI stuff. If asynchronous is fine, you can just use javax.swing.SwingUtilities.invokeLater . If you need your primitive to wait for the action to complete before execution continues, the workspace class provides waitFor and waitForResult methods for that (the former returns void, the latter returns a value). Setting foreverOn to true is part of the story, but not the whole story; see (e.g.) ButtonWidget.respondToClick to further details. This request (pressing and unpressing forever buttons from code) is one that has been made repeatedly over the years, so I imagine if someone made an extension that did it, other folks would be interested. -- Seth Tisue | Northwestern University | http://tisue.net developer, NetLogo: http://ccl.northwestern.edu/netlogo/ -- You received this message because you are subscribed to the Google Groups "netlogo-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
