Button templates allow you to store a collection of settings inside a file with a .3bt extension. This collection of settings can easily be applied to new buttons that you create. The use of button templates can simplify the development of skinned applications.
Let's create and use our first button template at design-time:
• | Right-click the control and choose Properties. The control's property sheet will appear. |
• | On this sheet you can already load an existing template by pressing the "Load template..." button or saving current settings into a template by pressing the "Save template..." button. |
• | If no control's setting has still been changed and no template is currently available, click the Edit properties... button |
• | Inside 3D Button Visual Editor, adjust the button's settings to achieve the desired appearance. |
• | Now select the Button menu item and select the Save template (or Save Extended template, see below their difference) sub-item in order to save your first template inside a .3bt file. |
Now if you wished to create another button with the same properties as the one above, you would simply import its template file into the the new button as follows. A big time-saver, isn't it?
• | Right-click the control and choose Properties. The control's property sheet will appear. |
• | Click the Edit properties... button |
• | Inside 3D Button Visual Editor, select the Button menu item, select the Load template sub-item and choose the .3bt file you saved before: the button will now have the same characteristics as the previous one. |
• | Repeat the operation for all buttons for which the same appearance is desired. Of course, once you have imported the template settings, you can always change the settings in the target control. |
There are two kinds of button templates:
• | Normal template: can be created and loaded at design-time using the procedure described above or at run-time using the SaveTemplate and LoadTemplate methods. The Normal template does not store file paths for pictures, textures, sounds and cursor. |
• | Extended template: can be created and loaded at design-time using the procedure described above or at run-time using the SaveTemplateEx and LoadTemplateEx methods. The Extended template does store file paths for pictures, textures, sounds and cursor. Note that the Extended Template must be used in conjunction with the SetTemplateBinDir method in order to specify the template's directory on the target machine. |
Note that, at Design-time, 3D Button Visual Editor allows the use of a set of predefined templates. Simply select one of the available Templates samples Tabs below and click the template you prefer: its settings will be automatically transferred to the button under editing.
a set of templates for Vista's "Aero" style is provided
and a set of templates for Office 2003 and Office 2007 styles is provided as well
You can also define a set of templates for future uses through the Your templates Tab.
This Tab can work in both Load Mode and Save Mode, depending upon the selected radio button:
• | In Load Mode, clicking one of the available templates will force the button under editing to change its settings accordingly. |
• | In Save Mode, clicking one of the available templates will force the clicked template to receive the settings from the button under editing for future uses. |
|