adding reflections to the bbzoombar class.
over the holidays, i have done some additional enhancements to the bbzoombar class. wouldn’t it be nice to have the icons reflected on the bar, with the reflections moving and zooming as well? well this class now has them.
also the class has been revamped to allow for more than 9 buttons. now you can have up to 99 but that would be overkill.
i have also added a builder to the class. to use the new class, just drop it on a form, resize the container and arrange the grey bar centrally with the proper height and top. (see note below)
next add code to the init as before:
* sample calling code
with this as zoomcontainer
.addbuttons("firstbutton","explorer96.png","this is the first button")
.addbuttons("secondbutton","folder96.png", "click here for a file")
.addbuttons("thirdbutton","monitor96.png", "monitor events")
.addbuttons("fourthbutton","music96.png","play your music")
.addbuttons("fifthbutton","photo96.png","view your photos")
.addbuttons("searchbutton","search96.png","search for anything")
* this must be called
the above code will give me 6 buttons. the parameters are as before:
p1 = name of the button stored in the tag property for identifying the button
p2 = the name of the icon to use. png’s are best since they resize properly and can also have a transparent background
p3 = this is the tooltip text for the button. you will have to switch showtips on in your form.
as you can see i have added more properties for more control. these properties can be set individually or using the new _memberdata builder included in the class.
the new properties to be set are:
showreflections – reflections on or off
centerzoom – zoom centrally or zoom upwards
reflectionext – the extension for the reflections
buttonsize – the initial size of the buttons.
this last was added since png images look good with the main icons but flicker when used in the reflections. for reflections, gif is the best format and the one i use. bmp’s do not look good when shrunk.
all the above properties have been brought together in a builder using the property name:
the builder is stored in the class as a form – propertywizard.
if you highlight this property in your favourites, and click on the button to the right of the property, the builder will open where you can make all the above settings. all properties have tooltips and are self explanatory.
once you have applied the settings in the builder, just run the form and enjoy the effect.
to trap clicks, just add code in the buttonclicked method of the class. the whole button object is passed, so you can actually use any property. however the name passed as the first parameter above is stored in the tag so you could have code here like this:
local ctag as string
ctag = tobutton.tag
case ctag = "firstbutton"
* do something
case ctag = "secondbutton"
* do something
case ctag = "thirdbutton"
* do something
included in the zip is a form – inatoolbar.scx where the class has been added to a toolbar class, that behaves just like any other toolbar.
note: the initial top of the buttons will depend on the position of the grey bar. the initial top will be set so that about 1/2 of the button protrudes above the grey bar. so you will also need to resize and reposition the grey bar so that the buttons appear properly.
as always i welcome your comments and suggestions.
you can download the complete source and this document from the link below:
hope you all have a great new year 2008.
unfortunately because of the amount of junk mail being generated from the weblog i have switched off comments. please post your comments, if any, at www.foxite.com