- Local time
- Today, 12:44
- Joined
- Feb 19, 2013
- Messages
- 17,093
Some time ago Isladogs developed a suggestion of mine for a toggle button - https://www.isladogs.co.uk/on-off-toggle/
This was then taken up by Mike Wolfe and further improved by Steve Halder - https://nolongerset.com/triple-state-modern-on-off-switch/
Problem is, it doesn't work well with a continuous form, so I thought I would see if it was possible. This is my solution. There are 3 versions, simple, triple and mouseover.
Note that this will not work with a scrollable continuous form - it uses the absoluteposition property. Further work would be required to take account of the scroll position to modify this position, so can be done, I just haven't done it for this example.
The button can mean what you like 'yes/no', 'on/off', 'agree/disagree', 'choose left/choose right', just depends on the context. This example is based on 'choose left/choose right'
an example of the simple version. Just click on the control to switch between left and right
for the triple state, there is a middle position which might mean don't know/don't care/use default/undecided. For this click on the left, right or middle of the control to switch between options. In the code there is an alternative so the user can step through the options on each click if that is the preferred behavior.
finally there is the mouseover effect - the relevant control is highlighted when the mouse is over the relevant control. Note I've increased the spacing slightly to ensure the relevant code can fire. This otherwise works the same way as the triple state.
The control is an image - you will find the images in the msysResources table, or you can build your own. These were made using a button with the font set to webdings and the character chr(110)- lowercase n. There are other fonts and characters you can use instead. For example in wingdings 3 these are chr(133) and chr(134) respectively. and chr(152) in webdings. Plenty to choose from.
All three forms work off the same table - so if you choose a triple option and return to the simple form, this is not a bug it may be that the selection does not match - just click where the control is and the control will reappear. In a real situation, you would have consistency with the values.
This was then taken up by Mike Wolfe and further improved by Steve Halder - https://nolongerset.com/triple-state-modern-on-off-switch/
Problem is, it doesn't work well with a continuous form, so I thought I would see if it was possible. This is my solution. There are 3 versions, simple, triple and mouseover.
Note that this will not work with a scrollable continuous form - it uses the absoluteposition property. Further work would be required to take account of the scroll position to modify this position, so can be done, I just haven't done it for this example.
The button can mean what you like 'yes/no', 'on/off', 'agree/disagree', 'choose left/choose right', just depends on the context. This example is based on 'choose left/choose right'
an example of the simple version. Just click on the control to switch between left and right
for the triple state, there is a middle position which might mean don't know/don't care/use default/undecided. For this click on the left, right or middle of the control to switch between options. In the code there is an alternative so the user can step through the options on each click if that is the preferred behavior.
finally there is the mouseover effect - the relevant control is highlighted when the mouse is over the relevant control. Note I've increased the spacing slightly to ensure the relevant code can fire. This otherwise works the same way as the triple state.
The control is an image - you will find the images in the msysResources table, or you can build your own. These were made using a button with the font set to webdings and the character chr(110)- lowercase n. There are other fonts and characters you can use instead. For example in wingdings 3 these are chr(133) and chr(134) respectively. and chr(152) in webdings. Plenty to choose from.
All three forms work off the same table - so if you choose a triple option and return to the simple form, this is not a bug it may be that the selection does not match - just click where the control is and the control will reappear. In a real situation, you would have consistency with the values.
Attachments
Last edited: