Log in or register to post comments

adding and disabling buttons at runtime

February 29, 2012 - 10:39pm #1

hello everyone
i m working on an application using the virtual buttons example.
i just wanted to know that is it possible to disable a virtual button at runtime??
the requirment of the application is that initially when the app is started, buttons are shown like a menu, and when either button is pressed, both the previous buttons are disabled and a new menu consisting of 3 or 4 buttons is shown and again if a button from those buttons is pressed, then a submenu consisting of 3 new buttons is shown while disabling the previous 3/4 buttons...
is this applicaion feasible using the latest sdk 1.5.9 vuforia or the 1.5 beta sdk????
plz help :(

Re: adding and disabling buttons at runtime

March 7, 2012 - 9:52pm #8

okay thankyou kim :)
i'll give it a shot and let you know

Re: adding and disabling buttons at runtime

March 7, 2012 - 6:59am #7

Sure, this should be possible with both the native SDK and the Unity extension. You will need to code it up yourself. I might suggest creating and destroying the buttons as needed (rather than enabling/disabling them).

- Kim

Re: adding and disabling buttons at runtime

March 7, 2012 - 1:29am #6

p.s is it possible on unity extension???? :)

Re: adding and disabling buttons at runtime

March 6, 2012 - 10:03pm #5

what im talking about is a menu meaning 4 new buttons apart from the previous two.
for example, the first two buttons that appear are an option for the user to select his/her language. once the language is selected, the menu which actually are 4 new buttons in that respective language shows up. And when one of them is selected, a sub menu consisting of 3 new buttons shows up while the previous 4 buttons dissapear.

Re: adding and disabling buttons at runtime

March 5, 2012 - 1:18pm #4

You could change the configuration of virtual buttons in response to a button press, yes. I recommend setting a flag when the user presses the button in the renderFrame method (VirtualButtons.cpp), and adding/removing buttons in the next pass of the QCAR_onUpdate callback.

Quote:

when either of them is selected the buttons disappear and a menu shows which further consists of 4 buttons

I'm not sure what you mean by this, are you talking about a 2D menu or something rendered on the target?

- Kim

Re: adding and disabling buttons at runtime

March 5, 2012 - 2:35am #3

is it possible that when the app is running and the marker has been recognized, 2 buttons show as an option to select. when either of them is selected the buttons disappear and a menu shows which further consists of 4 buttons, and then again when 1 of them is selected, all 4 of them disappear and another menu consisting of 3 buttons pops up.
im a newbie in qcar so please help :/

Re: adding and disabling buttons at runtime

March 1, 2012 - 3:40pm #2

Sure, see the toggleVirtualButton method in VirtualButtons.cpp in the VirtualButtons sample. That bit of code actually creates and destroys the buttons, but you can simply enable and disable them if you prefer:

// disable the virtual button
virtualButton->setEnabled(false);

Note that this method cannot be called while the dataset is active. See the QCAR_onUpdate method in that same file for sample code that deactivates and reactivates the dataset.

- Kim

Log in or register to post comments