Changing the last line of the modified code to:

        if(band_20m_index < 0)
                band_20m_index = band_20m_register-1;

makes it completely circular.  Try it!

Bob K5KDN

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Bob Tracy
Sent: Sunday, September 04, 2005 2:37 PM
To: FlexRadio@flex-radio.biz
Subject: [Flexradio] Going up/down in the bandstack


All,

There was a lot of discussion on the TS forum last Saturday about being able
to reverse direction when moving through the bandstack registers.  I was
playing around with it today and came up with a method for doing this using
a Shift+Click to go backwards through the register.  Unfortunately, I did
not see a way to modify Eric's ThreadSafe Control class to make the mod in
only one place so it would have to be added to each band button click method
in console.cs.  Here's an example for the 20 meter band button:

Unmodified code snippet from btnBand20_Click():

        ...
        if(last_band.Equals("20M"))
                band_20m_index = (band_20m_index+1)%band_20m_register;
        ...

Modified:

        ...
        if(last_band.Equals("20M"))
                //BT 9/4/05 Move down if shift key depressed with click
                if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                        band_20m_index = (band_20m_index-1)%band_20m_register;
                else
                        band_20m_index = (band_20m_index+1)%band_20m_register;  
//original line

                // Don't let the index go negative
                if(band_20m_index < 0)
                        band_20m_index = 0;
        ...

Clicking the band button works as usual, doing a Shift+Click moves backwards
through the register.  It stops at the bottom of the register, might be
worth a little more code to make it circular.

The code seems to work fine but I have not done any extensive testing.

Bob K5KDN


_______________________________________________
FlexRadio mailing list
FlexRadio@flex-radio.biz
http://mail.flex-radio.biz/mailman/listinfo/flexradio_flex-radio.biz



Reply via email to