WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-08-2009, 09:43 AM
moooh moooh is offline
Member
 
Join Date: Dec 2008
Posts: 19
button events when drawing over gui elements

I have a quad that I'm drawing that acts as sort of like an info screen that can be shown/hidden by pressing a key. The quad contains several different areas that can be clicked and the chosen area is determined in a mousedown event.

Part of this quad, when visible, overlaps a vizinfo menu that contains buttons. I've made sure that the quad is drawn over the menu, however, when clicking at the spots that overlap the vizinfo buttons, the button events are fired instead and the mousedown event is skipped completely. This has probably something to do with GUI elements like buttons being considered always in front when clicking.

The drawOrder of the elements does not seem to affect which event is fired.
I have tried switching around priorities for the menu onButton event and the mousedown event callbacks but that didn't help either.

One workaround would be to disable the buttons in the menu when the quad is visible, however the buttons are not easily accessible from the part of the code that deals with opening and closing this infowindow.
Just wanted to ask if there's some way to make the mousedown event have the same internal priority that the GUI components seem to enjoy.
Reply With Quote
  #2  
Old 04-09-2009, 01:03 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
In your case the mouse button event is not being passed on. Would it work to send a mouse event when the button event occurs?
Code:
import viz
viz.go()

import vizinfo
infoObject = vizinfo.add('Give me feedback!')
button = infoObject.add(viz.BUTTON, 'Push me')

def onMouse():
	pos = viz.mouse.getPosition()
	print 'mouse is currently at',pos
	
vizact.onmousedown(viz.MOUSEBUTTON_LEFT, onMouse)

def onButton(obj,state):
	if state == viz.ON:
		viz.sendEvent( viz.MOUSEDOWN_EVENT, viz.MOUSEBUTTON_LEFT )

viz.callback(viz.BUTTON_EVENT,onButton)
Reply With Quote
  #3  
Old 04-10-2009, 01:01 AM
moooh moooh is offline
Member
 
Join Date: Dec 2008
Posts: 19
Good call. If we can't prevent the button event from running I guess the second best thing is to make sure both events are run instead.
I can easily make sure that the onbutton does nothing except passing on the mouse event when the infobox is open, so this will definitely work. Thanks!
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
Wanda button events on flock of birds Atul Thakur Vizard 12 01-18-2008 03:04 PM
button problems cade_mccall Vizard 3 02-22-2007 09:48 AM
on/off button bailenson Vizard 1 09-28-2004 05:13 PM


All times are GMT -7. The time now is 02:32 AM.


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