[Gambas-user] New Component - UCToolbar

Robert Rowe robert.c.rowe at ...626...
Thu Apr 3 05:00:33 CEST 2008


My toolbar code is attached. It is not done but it is stable. Testers 
are welcome to try it out. If you run into a bug please try to be very 
detailed when you report it. Feature requests are welcome also.

Follow the instructions below to install it.

1. Extract the files somewhere.
2. Open the project with Gambas3. I stay pretty current so you might 
have too also.
3. Select "Make/Executable" from the Project menu.
4. Close the project and re-open it. This step may not be necessary but 
it should ensure that the component gets loaded.
5. Go to the Components tab of the project properties and make certain 
that UCToolbar is checked.
6. Look in on the Form tab of the toolbox for a question mark icon and 
double click it. This is the UCToolbar. I haven't figured out how to 
give it an icon yet.
7. Uncomment all the code in FTest.
8. Run the program.
9. Steps 5 and 6 are all that's required for a new project.

Here's how to use it:

1. Use the Add* methods to add tools. Right now it supports ToolButtons, 
ToggleButtons, Labels and Dropdowns. I have plans to add a MenuButon and 
probably others. Most of the parameters are optional but the Key and 
Description are required. The Label tool also requires the Text parameter.
2. Set the DefaultTools property. This is a comma separated list of 
keys. The tools with these keys will appear in the order that they are 
specified. A uctseparator is a transparent panel that has a width of 8. 
A uctlineseparator is also an 8 pixel wide panel but it has a vertical 
separator in it.
3. Call the LoadUserConfig method. This will reload any config 
previously saved by a user.
4. The UCToolbar will automatically stretch the full with of its parent.
5. When you run, you will notice a small down arrow to the far right. 
Click it to bring up the user config screen. Use the up, down, left and 
right buttons to select the desired tools. Double clicking the tools 
also works. Clicking the Default button will reload the tools from the 
DefaultTools property.
6. You can set the ShowButtonText property to show/hide the text for 
each tool. At this point the text will only appear to the right of the 
icon. This will change when the ToolButton control supports other options.
7. The Click event will fire whenever a tool is clicked. It has a string 
parameter called Key that will tell you which tool was clicked.

Current limitations:
1. You can only use icons that are no more than 16 pixels tall.
2. The toolbar will always be 21 pixels high.
3. I haven't implemented any routines for manipulating Dropdowns yet. 
You can load them during the AddDropdown call but that all for now.
4. It doesn't support right to left yet.
5. If you display more tools than can fit, the excess tools will not 
show. I plan to add another button that will show the missing tools in a 
menu.
6. No help written yet but I do plan to write some.

Unlike the existing Gambas toolbar, the UCToolbar is not a container. 
You add tools via the Add* methods. I hope to be able to add a GUI for 
the setup of tools and for generating the DefaultTools property.

This component was inspired by KDE. I've taken pains to make it work as 
closely to KDE apps as I can, mainly because I love KDE.  I don't use 
Gnome but I'd be happy to work with a Gnome user to make it act more 
Gnomish. :)

In the future I'll have updates available from my work's website if I 
can get permission to do so. I hope to eventually get the UCToolbar 
added to the main Gambas source distribution. Benoit has strict 
standards though so this may take me a while.

I have not localized it as I only speak/read English. I did try to mark 
all text as translatable though so it should be possible if someone 
wants to work on it.

Robert Rowe

-------------- next part --------------
A non-text attachment was scrubbed...
Name: uctoolbar.tar.gz
Type: application/x-gzip
Size: 103756 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080402/0eecd540/attachment.bin>


More information about the User mailing list