Friday, November 11, 2011

ssSwitch

ssSwitch is actually a remake of my old Switchbox class, the very first class I made and where the idea of creating several ssclasses later originated. 

For those who are not familiar with that one, SwitchBox class (as well as this one now) is an attempt to replace a checkbox with something unique.  I called this a switch because the appearance seems to switch on and off.


There really is not much difference with a checkbox and a switchbox (or ssSwitch in this case now).  Both can handle a logical values of .T. or .F., or a numeric values of 0 or 1.  Like a checkbox, you decide what you need to use.

Unlike the old Switchbox class however, this new class is cleaner, leaner and better.  I only got two original themes from Switchbox class and created 2 new themes for this one.  To use it, simple double-click it and in its Init event pass 1, 2 or 3 parameters like this:

This._settings( < Caption to use in the switchbox >, < logical or numeric value to start >, < Theme 1, 2,3 or 4 > )

Example:

This._settings("Show \  && Starts with value 1 or ON status and theme 3

Default value is a logical .F. and Theme is 1.

This is also the first class I decided to finally implement calculating the font width so the class' width can auto-adjust based on the length of the caption without developer specifying the width of the class.

And like my latest _ssclasses now, you can get its current value like this:

llValue = this._ssSwitch1.value
lnValue = this._ssSwitch1.value

when it is in the ON status, caption is bold.

In addition, like an ordinary native VFP Objects, you can use its click event to do something.

This will surely "spice-up" the appearance of your forms.

2 comments:

  1. dear,
    how i can get your classes?
    thanks

    ReplyDelete
  2. You can get it here: https://vfpx.codeplex.com/releases/view/99045

    ReplyDelete