Discussion:
Tile Scripting in Tweak
Sachin Desai
2005-10-19 03:18:57 UTC
Permalink
I'm trying to understand how to do tile scripting in Tweak. What I'd
like to be able to do is to write
a script that listens on an event and when triggered, perform an
action or a set of actions.

I see the standard events in CEventType and have defined my own class
in a similar manner that
returns user specific events that I'd like to listen for.

In CTileDefinition, I've defined a category and added a type for the
class based on forEach:do:until:
in "test and repeat" as this was the closest match to what I was
looking for.

<category name="MyTest" type="MyTestClass">
<message selector="forEach:do:" name="for each:do:" help="my event
control structure">
<argument name="event" type="CMyEventType" default="myevent"/>
<argument name="block" type="CBlockType"/>
</message>
</category>

The above is modeled on this:

<category name="test and repeat">
...
<message selector="forEach:do:until:" name="for each:do:until:"
help="control structure">
<argument name="event" type="CEventType" default="mouseMove"/>
<argument name="block" type="CBlockType"/>
<argument name="stopEvent" type="CEventType" default="mouseUp"/>
</message>
...

When I open the viewer, I see the category name and I can drag the
tile and select the event. My question
is how do I add content to the block or what can I put there? Am I on
the right track? What I'd really like to
do is to add other tiles that are actions for the tasks I want
performed.

Any guidance/help would be greatly appreciated.


-- Sachin.
Bert Freudenberg
2005-10-19 08:56:28 UTC
Permalink
Post by Sachin Desai
I'm trying to understand how to do tile scripting in Tweak. What
I'd like to be able to do is to write
a script that listens on an event and when triggered, perform an
action or a set of actions.
In CTileDefinition, I've defined a category [...] Am I on the right
track?
Actually, making a script that is triggered by an event is much
simpler ;-)

In a scriptor, click on the field to the right of the tiny clock
icon. You'll get a menu where you can choose the trigger for this
script. There are all the UI events, and you can define your own
event by choosing the 'more...' entry. (If you do not see that entry
as the last item, but "other", you need to update).

You'll get a string input box, just type your event name in there.

We should probably add some way to present a list of events specific
to the scripted object, but we haven't implemented that, yet.

- Bert -
Sachin Desai
2005-10-19 19:03:20 UTC
Permalink
Thanks Bert. Is there any way that I can capture the argument that's
passed to the event.
Some of the events I have also take an argument as shown below.

onAnEvent: arg
<on: anEvent>
...

-- Sachin.
Post by Bert Freudenberg
Post by Sachin Desai
I'm trying to understand how to do tile scripting in Tweak. What
I'd like to be able to do is to write
a script that listens on an event and when triggered, perform an
action or a set of actions.
In CTileDefinition, I've defined a category [...] Am I on the
right track?
Actually, making a script that is triggered by an event is much
simpler ;-)
In a scriptor, click on the field to the right of the tiny clock
icon. You'll get a menu where you can choose the trigger for this
script. There are all the UI events, and you can define your own
event by choosing the 'more...' entry. (If you do not see that
entry as the last item, but "other", you need to update).
You'll get a string input box, just type your event name in there.
We should probably add some way to present a list of events
specific to the scripted object, but we haven't implemented that, yet.
- Bert -
_______________________________________________
Tweak mailing list
http://impara.de/mailman/listinfo/tweak
Bert Freudenberg
2005-10-19 20:44:32 UTC
Permalink
This is not implemented, yet. Your script will still be triggered,
but you cannot access the argument. Of course, if the event is just a
fooChanged event, you can simply read out the foo field in your script.

- Bert -
Post by Sachin Desai
Thanks Bert. Is there any way that I can capture the argument
that's passed to the event.
Some of the events I have also take an argument as shown below.
onAnEvent: arg
<on: anEvent>
...
-- Sachin.
Post by Bert Freudenberg
Post by Sachin Desai
I'm trying to understand how to do tile scripting in Tweak. What
I'd like to be able to do is to write
a script that listens on an event and when triggered, perform an
action or a set of actions.
In CTileDefinition, I've defined a category [...] Am I on the
right track?
Actually, making a script that is triggered by an event is much
simpler ;-)
In a scriptor, click on the field to the right of the tiny clock
icon. You'll get a menu where you can choose the trigger for this
script. There are all the UI events, and you can define your own
event by choosing the 'more...' entry. (If you do not see that
entry as the last item, but "other", you need to update).
You'll get a string input box, just type your event name in there.
We should probably add some way to present a list of events
specific to the scripted object, but we haven't implemented that, yet.
- Bert -
Sachin Desai
2005-10-20 04:10:08 UTC
Permalink
Thanks for the information. Unfortunately, the event is not a change
event so I have a workaround
which I'll remove when the implementation exists.

Thanks for your help.

-- Sachin.
Post by Bert Freudenberg
This is not implemented, yet. Your script will still be triggered,
but you cannot access the argument. Of course, if the event is just
a fooChanged event, you can simply read out the foo field in your
script.
- Bert -
Post by Sachin Desai
Thanks Bert. Is there any way that I can capture the argument
that's passed to the event.
Some of the events I have also take an argument as shown below.
onAnEvent: arg
<on: anEvent>
...
-- Sachin.
Post by Bert Freudenberg
Post by Sachin Desai
I'm trying to understand how to do tile scripting in Tweak. What
I'd like to be able to do is to write
a script that listens on an event and when triggered, perform an
action or a set of actions.
In CTileDefinition, I've defined a category [...] Am I on the
right track?
Actually, making a script that is triggered by an event is much
simpler ;-)
In a scriptor, click on the field to the right of the tiny clock
icon. You'll get a menu where you can choose the trigger for this
script. There are all the UI events, and you can define your own
event by choosing the 'more...' entry. (If you do not see that
entry as the last item, but "other", you need to update).
You'll get a string input box, just type your event name in there.
We should probably add some way to present a list of events
specific to the scripted object, but we haven't implemented that, yet.
- Bert -
_______________________________________________
Tweak mailing list
http://impara.de/mailman/listinfo/tweak
Continue reading on narkive:
Loading...