WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-27-2005, 10:42 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

1) Yes, your callback will overwrite any callback set by the user

2) Well, if you register a timer callback then it will overwrite the users timer callback, so they won't get any timer events.

Using an Event Class is the proper way to handle events in separate modules. For example, if you wanted your module to handle timer and keydown events you would do the following:
Code:
import viz

#Create class that inherits from viz.EventClass
class _VHILEvent(viz.EventClass):
	def __init__(self):
		viz.EventClass.__init__(self)
		
		#Register callback for this class instance
		self.callback(viz.TIMER_EVENT,self.mytimer)
		self.callback(viz.KEYDOWN_EVENT,self.mykeydown)
		
		#Start a timer that belongs to this instance
		self.starttimer(0,0.1,viz.FOREVER)
		
	def mytimer(self,num):
		pass
		
	def mykeydown(self,key):
		pass
		
#Create an instance of _VHILEvent class
_VE = _VHILEvent()
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:25 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC