home *** CD-ROM | disk | FTP | other *** search
-
- Multi-Button Control for Visual Basic by Mark Gamber 1992
-
- The Multi-Button is a single control which divides itself into several small
- "sub-buttons", each acting as an independent button in itself. The Multi-Button
- may be used for multiple choice entries, array and matrix entries, spreadsheet
- headers and so on. Each sub-button may be individually raised or pressed under
- software control and the raised and lowered background and text colors may be
- changed for an entire control. If you have the original version, this version
- far surpasses it's functionality as will be demostrated. To use the button,
- copy VBMBTTN.VBX to your Visual Basic directory, select "Add File..." from the
- Visual Basic "File" menu and select VBMBTTN.VBX from the list of files. Once
- selected, a Multi-Button icon should appear in the toolbox.
-
-
- Limitations:
-
- The Multi-Button is capable of dividing into 256 sub-buttons. Should you go
- beyond that limit, you will be greeted with a UAE. There is no error checking
- provided to ensure you stay within that limit as it could be exceeded by any
- combination of things. Therefore, it is up to the programmer to ensure no more
- than 256 sub-buttons are displayed by a single Multi-Button.
-
-
-
- Events:
-
- Only one event is supported directly by the Multi-Button. "Clicked" provides
- the sub-button number and whether the button click raised or lowered the sub-
- -button. "Button" always begins with 0 and runs to 255. The actual range to
- expect depends on the number of sub-buttons displayed. "Pressed" is 1 if the
- sub-button was pressed, 0 if it was raised by the click event.
- GotFocus and LostFocus are supported by Visual Basic. Basically, since the
- control cannot use keyboard input, it should never get the focus. In the off
- chance that it does, you should use GotFocus to immediately change the input
- focus to another control on a form.
-
-
-
- Properties:
-
- The Multi-Button numbers it's sub-buttons internally from 0 to 255. You may
- change the number DISPLAYED by altering the value in "NumBase". NumBase is
- added to the internal sub-button count as the sub-buttons are painted. Thus, if
- you want a range from 1 to 10, you would set NumBase to 1 and size the control
- so 10 sub-buttons are displayed.
- Numbers aren't the only thing displayed. By selected "True" for the "Alpha"
- property, letters may be displayed. In the case of letter labelling, a NumBase
- of 0 will cause the first sub-button to display as the letter "A". The sub-
- -buttons are incremented from "A" to "Z", "AA" to "AZ", "BA" to "BZ" and so on
- up to "ZZ".
- "Width" and "Height" are supported directly by the Multi-Button and are
- available in pixel format only. They comprise the width and height of the
- entire control. To set or look up the size of a sub-button, use the "SubWidth"
- and "SubHeight" properties. They, too, are available only in pixel format.
- Note that changing the SubWidth or SubHeight values should be followed by a
- change in size to the entire control to prevent partial sub-buttons from
- appearing. This is easily accomplished by setting the control size to the
- number of sub-buttons to be displayed times the Subsize changed.
- The sub-button background color may be set for both sub-button states. The
- default values are light gray for both states. In addition, the text color may
- be set for both conditions. Defaults are black if raised, blue if pressed. The
- "BackUp" property sets and retrieves the raised color value and "BackDown" sets
- and retrieves the pressed color value of the sub-button background. "TextUp"
- and "TextDown" perform the same function for the sub-button text. Setting these
- properties affects ALL sub-buttons in a given control.
-
-
-
- Methods:
-
- Not being very accustomed to Visual Basic terminology, I am not too sure of
- the difference between a property and a method but this seems to fall more into
- the latter catagory.
- A sub-button may be checked to see if it's raised or pressed. In addition, a
- sub-button may be raised or pressed under software control through the "Value"
- method. Since there may be up to 256 sub-buttons per Multi-Button, this is an
- array, each array part specifying a single sub-button. Pressing a sub-button
- consists of setting the Value for a sub-button to a non-zero number and raising
- a sub-button consists of setting a sub-button value to zero. Again, the array
- ALWAYS starts a ZERO, regardless of the button number displayed which only
- reflects the NumBase value. For example, if your Multi-Button is displaying
- sub-buttons from 1 to 10 and you want sub-button 1 pressed, you would:
-
- MultiBtn1.Value( 0 ) = 1
-
- To see if the same button has been pressed:
-
- if MultiBtn1.Value(0) <> 0 then ...
-
-
-
-
- Additional information:
-
- Thanks to PCC David for his suggestions leading to this version of the
- control. This is free software given two conditions:
-
- 1. Any information pertaining to the author (me) MAY NOT be changed.
- 2. I'm not liable. Period.
-
- MBDEMO has been included along with the Visual Basic source for the program
- to serve as an example of Multi-Button use. Questions, bugs and complaints are
- welcome. E-Mail to PCA MarkG on America Online. No substitutes. I don't take
- phone calls, letters or BBS mail.
-
- Mark Gamber (PCA MarkG)
-
-