Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 17th, 2024, 11:34 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Using RegisterEventHandler
PostPosted: May 23rd, 2010, 5:17 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Okay... not so much of a tutorial as an example to get you started.

This is built using OpusPro v7 -- may 2010 (not sure if it is backward compatible with prior versions)
The sample pub uses OpusScript, so more of an advance topic.

The basic idea here is this: use standard Opus Triggers to get things going, and then 'invoke' other CONTROLLING INTERFACE DEVICES (MouseWheel for example)... to perform other actions.

Have fun.


Attachments:
File comment: Sample .imp Pub.
Uses RegisterEventHandler() in scripts to control actions via MouseWheel. (may be useful to view and adapt --- even if not interested in MouseWheel)

MouseWheel_Illustration0520B10.imp [111.96 KiB]
Downloaded 953 times

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi
Top
 Profile  
 
 Post subject: Re: Using RegisterEventHandler
PostPosted: May 23rd, 2010, 9:06 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Morning Lar,

Interesting idea. Couple of points to look at:

1. You keep adding a new trigger on event mouse over. This isn't necessary - the EventID variable will tell you if the event already exists.

2. The passing of the this object from the mouse over event to a global variable for use in the new event (such as wheel up) is not necessary. The wheel up event will call the necessary function with the this object as defined in the RegisterEventHandler statement.

3. The pre registering of the events and forking of functions is not necessary.

4. UnRegisterEventHandler is a spelling mistake.

5. I'd suggest using OOP and assigning EventID to an Object's custom properties.

Hope this help.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Using RegisterEventHandler
PostPosted: May 23rd, 2010, 5:19 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Mack,

Thanks for the tips.

Yeah, I admit I have some funny stuff going on there.
This thing was more of a play and experiment some time ago, and after getting the basic RegisterEventHandler() going... I wanted to spawn more actions as well as learn how to have the Handler apply across multiple objects.

At one point I threw in some Drag & Drop std actions too (I think that was why I used the Global Variable... and just left it in).

re: 'UnRegisterEventHandler' -- seems to me to only work when it is: UnregisterEventHandler -- but I'm not sure that's it either.


Can you say more on points 3 & 5?


For those interested in this exercise, stay tuned and I'll get a cleaned-up example posted in due time.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Using RegisterEventHandler
PostPosted: May 27th, 2010, 11:37 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi Lar,

From memory as I don't have the script on screen;

3 - You had some code at the start of the script that pre registered the events mouse up / down. This is not necessary as the events should be registered on the mouse over event.

3b - You use fork to execute to the functions that should be triggered by the event handler.

5. You are adding the event handler to a variable, which is fine, but you can add it to the object that the event handler is attached to - this means that whenever you deal with the object (button / vector) you'll have access to its handler rather than some abstract variable.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Using RegisterEventHandler
PostPosted: May 28th, 2010, 6:30 am 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Hi Mack,

Thanks for expanding on that.
My scripting mind is a bit of confused lot right now (from other work I'm doing), so I'll likely get into this in the next few days and see what I can do with it.

Cheers

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group