View Full Version : Callbacks and macroscripts with buttons?
03 March 2008, 05:57 AM
Hi, I've only just started playing with callbacks. I have a basic understanding of them where I can get this to work
fn PrintSomething =
print " HEY it's working"
callbacks.addscript #byCategoryDisplayFilterChanged "PrintSomething()" id:#printTest
I have a macroscript that I use to show and change the hide by category without having to go to the display command panel which is this:
toolTip:"Hide By Category Geometry"
on isChecked do
on execute do (
hideByCategory.geometry = not hideByCategory.geometry
The issue I have, is that when I use this it works fine and the toolbar button changes if you change the hide by category with the keyboard shortcut. And it works fine by using the macroscript button. But when you change the hide by category option in the display command panel, the toolbar macroscript button doesn't change. I'm figuring I need to use a callback but am unsure of how to go about incorporating a callback into that macro. Can anyone help?
03 March 2008, 11:21 AM
Try putting this in your callback script:
03 March 2008, 12:21 PM
Hi Jon, thanks for the reply. I'm not sure what you mean though. I don't actually have a callback working with the macroscript. I need to know how to add a callback somehow to the macroscript so that when the checkbox in the display command panel is updated, a callback (that I don't know how to implement yet) will update the buttons on the toolbar accordingly. Not sure if I'm being clear with my explaination.
03 March 2008, 12:39 PM
Ah, I think I understand what you mean... Like have a seperate function that's executed with a callback that just updates the toolbar buttons when the display command panel is changed? I've just tried it and it works. I was obviously thinking about it in the wrong way with trying to merge the callback stuff INTO the macroscript somehow. That's made me think about it a different way. Thank you.
03 March 2008, 09:27 PM
Wouldn´t it be easier to just press Shift+G ?
03 March 2008, 02:45 AM
I do use Shift-G. The buttons on my toolbar are mainly a hide by category display so show what IS hidden by category without having to change the command panel. Not everyone would find them useful, but I do.
So after all that I have my callback working. I've just dropped this code into a .ms and put it into my script/startup directory. It all seems to be working how I want it to, but is the scripts/startup the right spot for this?
fn HideByCategoryUpdate =
callbacks.addscript #byCategoryDisplayFilterChanged "HideByCategoryUpdate()" id:#CgToolbarUpdate
03 March 2008, 02:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.