SLIDE 6 Accessibility
- Most controls have accessibility features
built into them.
- This allows for a mouse free control.
- You can hit the tab key to reach the
NumericUpDown and Trackbar controls and then use the arrow keys to change their values.
- Holding down the key accelerates the
change.
Trackbar
- Let’s use the trackbar.
- Drag a trackBar control to the Lab2 tab panel.
- In the Properties page:
– Set the Maximum value to 100,000 (or higher) – Set the (initial or current) Value to 10,000 – Set the LargeChange to 5,000 – Set the SmallChange to 1,000 – Set the Tick Frequency to 10,000
- Also add a Label control (static text) above the
trackBar to describe its purpose.
Trackbar
- We should now have something like:
Trackbar
- Okay, we have a control and it can change values, etc.
but we do not have anything useful connected to it.
– There are many ways you can use this:
1. The lazy way – simply read the control’s value whenever you need it. This mixes the business logic and the GUI logic. 2. The global document way – Whenever the value changes, change a corresponding data value in some document class. This still mixes the logic. Bad data hiding. 3. The document/view way – Whenever the value changes, call a method on the document’s class. The document now knows it’s value has changed.
- Perform some action (update display, verify data, etc.)
- Keep a history for undo/redo.