Konfabulator Woes

Ricky

Registered
I'm rewriting my CompactAirPort widget from scratch using my own code, but I'm having some trouble with the widget updating the percentage bar when the AirPort signal strength changes. The code for the percentage value is:
Code:
        function getSignal() {
		  
			theStrength = system.airport.signal;
			if ( theStrength > 50 ) {
				theStrength = 50;
			}
			theStrength = Math.round(100 * (theStrength / 50));
            airportsignal.data = theStrength + "%";
	        }
And for the percentage bar:
Code:
	    function getVal() {
	    
	        meterVal = system.airport.signal;
            if ( meterVal > 50 ) {
                meterVal = 50;
            }
            meterVal = (fill.width * (meterVal / 50));
            fill.width = meterVal;
            }
It's neccesary for the widget to use fill.width so that I can use themes without having all the fill widths be 120.

Both have "GetSignal();" and "GetVal();" onTimer... Don't know what the problem is.

Here's the widget if someone wants to take a look at the .kon file inside...

-EDIT- Forgot to mention, the actual percentage value shows up just fine.
 

Attachments

  • compactairport.sit
    74.9 KB · Views: 1
I'm no Konfabulator expert...in fact, I have never touched the damn thing! However, I can see that after every call to getVal(), fill.width will be reduced to some fraction of its previous value. Its previous value, not its maximum. I suggest doing something like storing fill.width's initial value in a variable like fillMaximum, and using that to compute meterVal instead of using fill.width.
[EDIT]

Okay, Konfabulator was already installed on this computer, but I couldn't try it because there was no Airport card. My suggestion should work however, but a Konfab expert should chime in with a better solution.
 
Back
Top