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:


lparameters tobutton

local ctag as string

ctag = tobutton.tag

do case

case ctag = "firstbutton"

      * do something


case ctag = "secondbutton"

      * do something


case ctag = "thirdbutton"

      * do something


* etc



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

8 Responses to Zoombar with Reflections

  • RsALs says:

    Thank you. Happy new year!

  • Mauricio Henao says:


    Can Send me the Example?


    Download from the link on the page

  • Guille (Asuncion) says:

    WOOOOOOW… i just can say!!! woooow!!!… that is amazing… thanks so much for share this class!!!… DEMASIADO LINDO LUEGO!!!! iiiipuuuuuuuuuuuuu!!! bye… chau

  • Chris-Jan says:

    I think this must be magic… 🙂

    Thank you and a great 2008 to you too!

  • John Reviews says:

    You are Hero!

    Thanks 🙂

  • cjulio says:

    i have yesterday implemented this on my code and it is great….

    but i added a small thing on the click off the button i reset the size off the image because if you open a modal window you will lock the button and it will be alway has if the mouse was over it…

    Good point. Anyway that is why I included the source so anyone could make changes.

    i have still not finished but i am trying to add a config to say if you want a reflection or a label (gif image with text gets distorted)or both..

    For Reflections there is a property called ShowReflections as in the builder. This could easily be changed from a .T./.F. to an integer – 0 = no reflections, 1 = reflections, 2 = label etc.

    saying what the button is under the image on mouse over….

    or you could enable tooltips and show the text there.

  • Rob says:

    Been using this with great success, but after an icon is clicked Foxpro seems to ignore any errors in my code thereafter? If I suspend in the button click code and enter a command wrong I get no error message, other commands work though. Only after I close the form down with the Zoom bar on it does the error

    • Bernard Bout says:

      Possibly you are setting error off somewhere in your form.

      I do not set any error handling in my class. I suggest you open your forms/classes and search for any “ON error” statement that is setting error off. I do not touch the On Error in my class.

Leave a Reply

Your email address will not be published. Required fields are marked *