XWidgetSoft Forum https://bbs.xwidget.com/ |
|
Using functions (solved) https://bbs.xwidget.com/viewtopic.php?f=8&t=2129 |
Page 1 of 1 |
Author: | Rejjy13 [ September 14th, 2012, 6:18 am ] |
Post subject: | Using functions (solved) |
This is my first time, please be gentle. I was trying to create a button to do the following - If volume is muted, unmute it and set it to maximum. If volume is not muted, mute it. How would I do that? I have designated the function to a button on the widget, but it does not work, does nothing. Here is the definition Code: function CheckMute(Sender) { if(%IsMute == false)//if not muted !SetMute else //if muted { !SetMute !SetVolume=100 } } All help is appreciated. |
Author: | Nutu [ September 14th, 2012, 6:40 am ] |
Post subject: | Re: Using functions |
Use a volume core and then write this in the button: Code: function CheckMute(Sender) { if(volume_core.Mute) { volume_core.Mute = false; volume_core.Volume = 100; } else { volume_core.Mute = true; } } This should work. If you get an error on the volume_core.Volume = 100; just delete that string. The volume is set to full, I believe. Best Regards, Nutu |
Author: | Rejjy13 [ September 14th, 2012, 7:23 am ] |
Post subject: | Re: Using functions |
@Nutu - no results. Thanks for your reply. Regards, Rejjy 14-Sep-2012 20:53 IST |
Author: | Nutu [ September 14th, 2012, 7:35 am ] |
Post subject: | Re: Using functions |
I'm using that script for my widget, so I don't know why isn't it working for you... |
Author: | qiancang [ September 14th, 2012, 8:53 am ] |
Post subject: | Re: Using functions |
a checkbutton control is better than a button control checkbutton1(bindingCore:volumecore1;format Core data:%IsMute) Code: function checkbutton1OnClick(Sender)
{ if(!checkbutton1.checked)volumecore1.volume = 100; } |
Author: | Rejjy13 [ September 14th, 2012, 11:00 am ] |
Post subject: | Re: Using functions |
@Nutu You say to "Use a volume core". Can you elaborate how would I do that? It is added in the cores part of the widget as volumecore1. However, I get a runtime error while debugging your code. I tried changing volume_core to volumecore1 but it resulted in the same error. Please bear with me, I'm knew at this. Thanks for the reply. EDIT : It worked. volumecore1 is the required name. Thanks. Post is solved. |
Author: | Nutu [ September 14th, 2012, 11:15 am ] |
Post subject: | Re: Using functions (solved) |
I'm glad I could help. ^^" |
Page 1 of 1 | All times are UTC - 8 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |