WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-30-2012, 04:59 AM
jaclyn.bill jaclyn.bill is offline
Member
 
Join Date: Oct 2007
Posts: 42
multiple sliders

Hello,

Hopeing there is a simple answer this this, but how do you distinguish between four sliders so that each slider alters a separate parameter.

I have 4 sliders sliderSWRD, sliderSWEX, sliderRTRD, sliderRTEX set at the four corners of my screen. When I use the follwing code to detect a response from say SWRD and change a parameter it works fine; however, responding with any of the other sliders also changes that parameter and I don't want this to happen.

HTML Code:
def reponse():
	global radadj, radius, adjustswing, swingmiddle
	def myslider(sliderSWRD, pos):
		adjustswing=swingmiddle-pos
		def onMouseDown(button):
			if button == viz.MOUSEBUTTON_RIGHT:
				radius=radius+adjustswing
				sliderSWRD.disable()   ### re-enabled elsewhere
		viz.callback(viz.MOUSEDOWN_EVENT,onMouseDown)
	viz.callback(viz.SLIDER_EVENT,myslider) 
Any tips would be useful, sure I'm missing something obvious. Thank you.
Reply With Quote
  #2  
Old 07-30-2012, 08:55 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You need to check that the slider object passed to the callback function is sliderSWRD before changing that parameter:
Code:
def onSlider(obj,pos):
    if obj == sliderSWRD:
        #change parameter

viz.callback(viz.SLIDER_EVENT,onSlider)
You can also use the vizact.onslider command to call different callback functions based on which slider was changed:
Code:
def onSliderSWRD(pos):
	#do something
	
vizact.onslider(sliderSWRD,onSliderSWRD)

def onSliderSWEX(pos):
	#do something
	
vizact.onslider(sliderSWEX,onSliderSWEX)
Reply With Quote
  #3  
Old 08-01-2012, 01:20 AM
jaclyn.bill jaclyn.bill is offline
Member
 
Join Date: Oct 2007
Posts: 42
Excellent Thank you very much.

Jac
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support for multiple video cards kopper Vizard 2 06-07-2013 03:50 PM
Multiple Cameras for AR artoolkit plugin Pho46 Vizard 3 11-10-2010 06:59 PM
Displaying multiple gui items in one line Enlil Vizard 4 08-05-2009 07:43 AM
multiple shadows using projector theuberk Vizard 13 02-24-2009 02:56 AM
Custom Drop-Down Menus and Sliders south_bank Vizard 2 05-20-2008 04:27 AM


All times are GMT -7. The time now is 09:08 AM.


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