XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 3:32 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Using functions (solved)
PostPosted: September 14th, 2012, 6:18 am 
Offline

Joined: September 14th, 2012, 6:12 am
Posts: 18
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.


Last edited by Rejjy13 on September 14th, 2012, 11:03 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Using functions
PostPosted: September 14th, 2012, 6:40 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
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

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


Top
 Profile  
 
 Post subject: Re: Using functions
PostPosted: September 14th, 2012, 7:23 am 
Offline

Joined: September 14th, 2012, 6:12 am
Posts: 18
@Nutu - no results.
Thanks for your reply.
Regards,
Rejjy
14-Sep-2012
20:53 IST


Top
 Profile  
 
 Post subject: Re: Using functions
PostPosted: September 14th, 2012, 7:35 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
I'm using that script for my widget, so I don't know why isn't it working for you...

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


Top
 Profile  
 
 Post subject: Re: Using functions
PostPosted: September 14th, 2012, 8:53 am 
Offline
User avatar

Joined: June 10th, 2012, 5:57 am
Posts: 313
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;
}


Top
 Profile  
 
 Post subject: Re: Using functions
PostPosted: September 14th, 2012, 11:00 am 
Offline

Joined: September 14th, 2012, 6:12 am
Posts: 18
@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.


Top
 Profile  
 
PostPosted: September 14th, 2012, 11:15 am 
Offline
User avatar

Joined: August 18th, 2012, 4:08 pm
Posts: 101
Location: Oradea, Bihor, Romania
I'm glad I could help. ^^"

_________________
" Homosexuality exists in 450 species. Homophobia is found in only one. Which seems unnatural now?
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group