Archive for October, 2007

The input controls inside the KryptonRibbon support ButtonSpecs in the same way that they are provided in the standalone versions of the Toolkit.  Here you can see a ButtonSpec added to a far edge of text box and to the near edge of a combo box…

You could use this ability to turn a simple text box into a search/find box…

Or maybe as a shortcut for the user to ask for additional help. Or to bring up a dialog box for providing advanced settings. The uses are limitless and make it quick and easy for you to make it obvious the extra feature is associated with the input control.

You can now add the three new input controls to the KryptonRibbon. These new elements actually reuse the recently added KryptonTextBox, KryptonRichTextBox and KryptonComboBox controls from the Toolkit. Here is a picture of each of the three input controls in the disabled state… 

And now in the enabled state…

Once the control receives focus, or if the mouse moves over it, then they change color to show they are active. Here you can see the combo box control becoming active as the mouse hovers over it…

Pressing the drop down button produces the expected result…

To modify the settings of the element you just need to click them at design time and the Properties tool window will show a large range of options, the same set of properties available when the controls are used standalone. There is also a property exposed, although not at design time, for getting direct access to the underlying control instance. So you can access the actual KryptonComboBox instance by using the ComboBox property of the appropriate ribbon element.

Our third new Toolkit control is the KryptonRichTextBox. As we have only just added the KryptonTextBox it makes sense to also add the rich version as well. The implementation works in the same way as previously, with a real WinForms RichTextBox embedded inside a Krypton Toolkit control.

Here it is in full techno-color…

The bottom instance has been given some RTF by assigning to the KryptonRichTextBox.Rtf property. Hence it shows using a variety of font settings and colors and also explains why it is not drawing in the same anti-aliased way as the other instances. I just creating some text in WordPad and exported it to a .rtf file. Then in the constructor of the samples I load the file into the control instance via the Rtf property.

I have exposed almost all the properties, methods and events as are present on the actual underling control and so you should be able to use it as a simple plug replacement for the original RichTextBox. But there might be some circumstances that you want direct access to the embedded control. You can do this using the KryptonRichTextBox.RichTextBox property.

For example the drag and drop set of events cannot be exposed via the actual Krypton control because that would be entirely to confusing. But you can hook into them in your code using KryptonRichTextBox.RichTextBox.DragEnter.

I like to think I’m responsive to customer feedback. There have been several requests to add  ButtonSpecs on the new KryptonTextBox and KryptonComboBox controls. Luckily it was pretty simple as I could reuse the existing code that implements them for other Toolkit controls.

Here you have a single ButtonSpec added to each control…

One use might be to add a ButtonSpec to indicate an error with the input field and let the user press the button to get more information about how to solve the validation problem. Or maybe you want to expose extra functionality for the input field, such as pressing the button to start a lookup of external information.

Another nice idea would be adding a context menu to the ButtonSpec, so that when pressed the user is given a popup menu from which they can select some prepared standard values for the input control. How about using the above ‘Close’ ButtonSpec as a quick way for the user to clear the field to be empty again.

Although I have shown just a single ButtonSpec you can of course define as many as you like.