Added MultiSelect capability. It is controlled by two properties:
- .F. (Default), only a single switch can be selected each time from the dropdown list. The caption of the selected switch will be reflected outright on the class
- .T. or allow multiselect. When this is set to .T., the caption will reflect the number of switches turned on (see image below)
- mValues = are character values representing which switches are turned on. On the image below, I set the initial mValues to 1,3,5. mValues change on-the-ply, or when you turn on and off available switches. Showing new Theme 17 I created just now too.
February 9, 2017
What is DropSwitch?
It is a Control class with a commandbutton that has a dropdown form with several switches based on your desire. You can think of the dropdown portion like an OptionGroup on a dropdown form, except that it does not use radiobuttons but my switches.
It is more like my OptionSwitchX class but this one hides the selection until you click the button. So if you want to change the value, click on it, click anew on the popup selections (change will reflect on-the-ply), and click outside.
Some more differences with OptionSwitchX:
1. In OptionSwitchX, I manually created 12 switches as max. Anyway, for more than that need, I counter they can use a grid, listbox or combobox for the needed selections. 12 switches, IMHO, is already enough.
DropSwitch does not have that limitation though as switches are created on-the-ply by the class based on your Caption, e.g., Credit,Cash,Cheque,Cover,Special,Internal. So it will create 100 switches if you put 100 words separated by comma on Caption property.
2. OptionSwitchX utilizes the _Settings() method. DropSwitch is via PEM
3. OptionSwitchX is a container class. I made OptionSwitchX as container because I need to be able to reach inside it during design time to re-position the switches to where I want those to be. Just like if I want those to be shown in landscape format.
DropSwitch, as mentioned, is a Control class. It takes care of the arrangement of the switches as controlled by Columns property. So if you want to make a single columned switches based on the caption above, you can say put 5 on Columns property. Then the class will position all switches that it will create on column 5 of the popup form (as shown above).
If you put on Column a value of 5,85 then the class will adjust itself to fit the switches to the desired columns
If you put on Column a value of 5,85,165 then again it will adjust itself.
4. OptionSwitchX eats more form space in comparison with this one as what will be used by this one is just a space for a single commandbutton.
You can use all the 20 themes of SwitchX class here. Here are some of my faves:
It returns two values:
.Value = the numeric value representing your selection, similar to an optiongroup
.ValCaption = is the Caption of the current seletion as reflected on the commandbutton it uses
You can set which of the switches based on the Caption property will be the starting value via Value property. So in the above images, starting Value is 2.
- FontName and FontSize = adjusts the caption, height and width of the commandbutton (won't affect the popup selections)
- Value and ValCaption (as Explained above)
- Columns (as explained above), allows you to control the column positions of the switches plus allows the class to calculate the number of rows it will use for the popup class
- Interval = is the spaces (row wise) between each switches. By default, it is 20. But you may want to increase or decrease the row gaps between each switches to your liking so this is the property for that
- _PopWidth = controls the width of the popup selections.
- _nTheme = is the theme for the switches
- Caption = is the Captions of the switches on popup form
- SpecialEffect = how the button will look like
Right now, you can use its Click event to perform say a method when you change its value
This is a young class so I may add more features in the future. Also I may add another version of this or just simply morph this to allow Multi-Selection of switches. Cheers!
P.S. This is part of ssUltimate Library.