A simple guide on how to use ThemedControls
Add the following files to your project:
- Text files from Other tab in Project Manager
Ctl32.h (mark it as "Excluded" from your project)
ThemedControls.h (mark it as "Excluded" from your project)
- Applications from Code tab in Project Manager
System.app (GDIPlusX from VFPX)
*** Don't forget to distribute these app file together with your application! ***
- Programs from Code tab in Project Manager
Ctl32.prg
Ctl32_Api.prg
Ctl32_Classes.prg
Ctl32_Functions.prg
Ctl32_Structures.prg
- Classes tab in Project Manager
Ctl32.vcx
ExplorerBar.vcx
OutlookNavBar.vcx
ThemedControls.vcx
ThemedControlsBuilders.vcx (mark it as "Excluded" from your project)
ToolBox.vcx
ZoomNavBar.vcx
*** Don't use controls from ExplorerBar.vcx, OutlookNavBar.vcx, ToolBox.vcx and ZoomNavBar.vcx directly because they are base classes. Use the subclassed controls in ThemedControls.vcx. ***
Before use any ThemedControl:
Create a ThemesManager object to handle themes.
You can do this in your startup program:
* Create a ThemesManager object that will be available at any time
If Not Vartype(_Screen.ThemesManager)=="O"
_Screen.Newobject("ThemesManager","ThemesManager","ThemedControls.vcx")
Endif
Don't forget to run the following code to destroy ThemesManager object before finish your application.
* Destroy ThemesManager object
If Vartype(_Screen.ThemesManager)=="O"
_Screen.RemoveObject("ThemesManager")
Endif
To use ExplorerBar:
- Add a ThemedExplorerGroup object from ThemedControls.vcx to your form;
- Double click CustomBuilder property in Properties Window to show the Builder;
- Fill the properties and click in Save and Exit button;
- Click with right mouse button in ThemedExplorerGroup and choose Edit from shortcut menu to edit the control;
- Click with right mouse button in cntUserControls and choose Edit from shortcut menu to edit the control;
- Place any control that you want inside cntUserControls;
- Repeat steps from 1 to 6 to create how much groups you want;
- Add a ThemedExplorerBar object from ThemedControls.vcx to your form;
- Select all ThemedExplorerGroups you created and press CTRL + X in your keyboard;
- Click with right mouse button in ThemedExplorerBar and choose Edit from shortcut menu to edit the control;
- Press CTRL + V in your keyboard to move all ThemedExplorerGroups inside ThemedExplorerBar.
To use OutlookNavBar:
- Add a ThemedOutlookNavBar object from ThemedControls.vcx to your form;
- Click with right mouse button in ThemedOutlookNavbar and choose Edit from shortcut menu to edit the control;
- Click in the empty control area to select the Panes pagreframe object;
- Set the PageCount property to the number of buttons that you want to display;
- In the Properties Window, activate each page and set Caption and Picture16 properties;
- Add the controls you want to display in each page (you can add any control: TreeView, TextBox, CommandButton, ...);
- Use ButtonClicked method to handle the correspondent button click. This method receive 3 parameters about the button clicked: lnNumber, lcCaption and lcPicture24.
*** Note that at run time, the control will create a button for each page and will use Caption and Picture16 page properties as the source of caption and picture button properties. ***
To use ToolBox:
- Add a ThemedToolBox object from ThemedControls.vcx to your form;
- Click with right mouse button in ThemedToolBox and choose Edit from shortcut menu to edit the control;
- Click in the empty control area to select the Panes pagreframe object;
- Set the PageCount property to the number of titles that you want to display;
- In the Properties Window, activate each page and set Caption property;
- Add the controls you want to display in each page (you can add any control: TreeView, TextBox, CommandButton, ...);
- Use TitleClicked method to handle the correspondent title click. This method receive a parameter named lcTitle containing the name of title clicked.
*** Note that at run time, the control will create a title for each page and will use Caption page property as the source of caption title property. ***
To use ZoomNavBar:
- Add a ThemedZoomNavBar object from ThemedControls.vcx to your form;
- In the Init method, place the code to add the buttons that you want to display:
DoDefault()
With This
.AddButton("Printers","Manage your printers.","Printer96.png")
.AddButton("Display","Change the display settings.","Monitor96.png")
.AddButton("Explorer","Show computer's files and folders.","Folder96.png")
*
.AddButton("Separator")
*
.AddButton("ControlPanel","Change your OS settings.","ControlPanel96.png")
.AddStackButton("ControlPanel","Button1","Add/Remove programs","Software32.png")
.AddStackButton("ControlPanel","Button2","Hardware settings","Hardware32.png")
.AddStackButton("ControlPanel","Button3","Network settings","Network32.png")
Endwith
- Use AddButton method to add a button and AddStackButton to add an option to a button menu.
Sintax:
AddButton( cButtonName, cToolTip, cImagePathAndName )
AddStackButton( cParentButtonName, cButtonName, cToolTip, cImagePathAndName )
- Use ButtonClicked and StackButtonClicked to handle the correspondent button click:
Lparameters lcName
Do Case
Case lcName=="Printers"
apiShellExecute(0, "Open", "Control.exe", "Printers", "", 1)
Case lcName=="Display"
apiShellExecute(0, "Open", "Control.exe", "Desk.cpl", "", 1)
Case lcName=="Explorer"
apiShellExecute(0, "Explore", "", "", "", 1)
Otherwise
Messagebox("Button '"+lcName+"' was clicked!")
Endcase
If you have questions, suggestions or want to report bugs, feel free to contact me.
Emerson Santon Reed
emerson_reed@hotmail.com