Radio buttons not redrawing

Post Reply
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Radio buttons not redrawing

Post by DoctorG »

Hello,
I think that this may be a bug, but I'm not sure.

I have a group of 12 buttons set with a GroupID of so that they act as radio buttons.

If I just press the buttons with a mouse they work just fine.

However, I also want, under certain circumstances, to change the button programmatically.

I have references to all the relevant buttons in an array, called Button, so that I can access a specific button based upon an integer index.

So I have code in the ProcessSample() method that:
1) detects when a different button should be pressed
2) calls Buttons[NewButton].SetValue(1.0); to simulate button press
3) this causes Notify() to run. Notify runs correctly in all cases.
4) I can see my actions associated with the programmatically selected button press take place.
5) The previously pressed button goes to the "released" colour and the newly "pressed" button goes to the "pressed" colour - sometimes!!!

It's the "sometimes" in step 5 that's causing me the problems.

Any idea what's causing this?

Does the ProcessSample() method call Notify() thereby causing ProcessSample() to take too long?

Any ideas about a workaround?

Many thanks...
gary
CherryRuss
Posts: 27
Joined: Sat Oct 20, 2018 9:29 pm

Re: Radio buttons not redrawing

Post by CherryRuss »

Hi Gary.

I suspect this may indeed be related to calling a GUI function from the audio-processing thread, largely because of the delay introduced by calling native functions, of which VoltageButton.SetValue is one.

Instead of calling button.SetValue directly from ProcessSample, try just storing the index of the button that needs to get selected in a variable and then having a timer processor check the variable and call button.SetValue instead.

Just as a refresher, this will create a timer that fires 20 times per second:

StartGuiUpdateTimer( 50 );

...and adding a "case GUI_Update_Timer:" to the big switch statement in Notify will let you know when it fires (new projects automatically get one of these added to them, so you've probably already got one unless you deleted it).

Let us know if this doesn't work.
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Re: Radio buttons not redrawing

Post by DoctorG »

Hi Russ,
Thanks for your suggestion. That idea had also occurred to me and didn't long to implement. However, the behaviour persists.

I'm fairly convinced that this is a bug. So I've written a simple example and uploaded it to my manufacturer's area, with the source code.

Please have a look at the ButTest module.

Notes are included with the module.

Many thanks for your time.
Gary

PS I think that the source code uploaded, but I'm not sure. If you didn't get the source email me and I'll send it via email.
Cherry Dan
Site Admin
Posts: 256
Joined: Fri Jul 27, 2018 5:36 pm

Re: Radio buttons not redrawing

Post by Cherry Dan »

Hi there,

We've figured out the problem, and we've fixed it for the next release of Voltage Modular, which is due out within a week (or so).

Thanks for letting us know about this issue!

All the best,
Dan
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Re: Radio buttons not redrawing

Post by DoctorG »

Wow, that was quick. Thanks!

I'll remove the module that showed the problem.

Gary
Post Reply

Return to “Module Designer”