*** i moved to my own blog site so to check on my future posts, please go to www.junblogs.com  ***

actually after creating the ssdtpicker, i already moved on working with the sstbnextgen class.  i finished the initial class with 7 themes after a few hours as i believe you knew now how fast i work when i feel doing a thing with of course no distraction.  on the same date i also started playing with the gui for the ssbutton which i also have in mind to complete the much needed makeup of a plain vfp exe. the gui and the class were finished the day after.  

normally i would have stopped right there and then to immediately create a post for sharing purposes not minding to enhance it further.   my reason?  those are just samples that can still be enhanced by interested users.  in reality, mostly what i am giving are just ideas and guides with the exception of some tools like live backup.

but since i received very positive responses on my last 3 classes, i decided and promised to give you better ones, not just mere ideas or guides.  and so i kept both sstbnextgen and ssbutton classes still with me for further testings and enhancements.  i completed enhancements on those two as of december 14 and actually created both sstbnextgen and this blog on the 15th.

however, i postponed posting these two blogs as i decided to give sstbnextgen as my pre-christmas gift to interested users and this one as a pre-new year’s present.  plus i have to post the promised “filler” which is optionswitch.

as seen on my sstbnextgen, it is better now.  you'll be still surprised though what this single button class can do as i have exerted a lot of effort to make this very flexible.  not in the codings though as i can find ways to use only a couple of those yet achieve what i want; but in "thinking" what more can be done.

those previous 3 classes can still be enhanced as i actually did not put much efforts on those as i am not sure then what would be the responses considering i will be doing the who's who. so wait next year and i will again work on those. 

actually, anil sharma is already working on enhancing the ssdtpicker as last time i sought his help to find out if that will run on vfp6 as i don't have one.  it runs well (except you need to remove an extra "k" on an object's name in one method inside the class which is what will be activated when using versions below 7).  in addition, he thought of some more enhancements that can be done so i requested him to apply those himself then just send me back the enhanced version. i will post that next year though as i have also some more things in mind that can further enhance the already enhanced version.

back to this class, i claimed this as the best so far among my classes. so is your level of curiosity getting higher on what this simple, insignificant, good for nothing, single button class can do as compared to ssdtpicker or on my other classes or ideas?  what could have possibly, a very simple puny button class like this can really do?  will this really give impact to your end as i believe it would be?  let us see.

here we go!

  • i included 3 themes here i called simple, fancy, and artistic.  they are to be activated as 1, 2, and 3.  but wait!  i think i have said 4 themes before, so where is the 4th?  

the 4th theme is actually numbered 0.  when you turn the theme into 0, you will have a transparent bar instead.  a lazy move on my part but i believe an ingenious one, lol!  it has an impact especially with the hottracking feature, believe me.

  • speaking of the hottracking feature, what the heck is that?  

when the mouse pointer enters the button area, the caption will turn into white (default).  when mouse pointer leaves, it will turn back to its previous color.

  • hottracking color’s default is white?  does that mean you can change color?  

yes, you can change color of the hottracking feature using an rgb() combination.

seems not that impressive?  then read further:

  • why did i said when mouse pointer leaves, it will turn back to its previous color?  why not simply say it will turn back to black?  

because you can likewise change the color of the caption.

  • in addition, you can also change the font of the caption
  • as well as font size
  • or make the caption bold
  • or make the caption italic

wait a minute, this button uses a font

yes it does.  that is one of my few surprises with this ssbutton class, i used plain font for caption to give it further flexibility.  default is arial, 9.

  • and since it uses font, i also gave the ability to set its alignment. default is 0 (left aligned) and can be changed into 1 (right aligned) or 2 (center aligned).

not yet satisfied?  there is more:

  • you can resize this button and it will do its own repainting.  the caption, the icon, and the borderline will likewise be resized.  when you change the font size, it will likewise do its own calculation to keep it vertically centered as possibly as the new size can permit vs the current height of the button.
  • speaking of the icon, you can reposition it anywhere within the button boundary, and a little bit outside of the boundary (lower portion) which gives it a cool impact.  i provided a little space for that effect to happen.

hmmm, starting to like the features now huh?  wait, we are not done yet!

  • speaking of borderline, what do i mean by that? why did i still use one?

during my initial creation of colored themes, the images are actually surrounded by a black line as that is what buttons supposed to have.  however, during the initial testings, when i resized/stretched a button image, the borders became too thick or too thin much to my disliking depending on the percentage of stretching i have done.  and it appears ugly.  solution?  create a separate line to act as a border which thick/thinness will not be affected by resizing, and so the borderline.

in addition, with this separate borderline, you can do these things to add further effect to the button itself: make it plain or with 3d effect. 

getting better and better?

  • you can change the button image into any of the 7 colors which are: red, green, yellow (gold), orange, blue, brown and pink (for the ladies, i never forget you).
  • and as i have said, we have 4 themes, well actually 3 that work with the color variations plus theme 0.  so that is a possible 22 different looks! but wait, since this button can be resized as well as the caption, then it goes beyond that count as can be seen in this image:

not to mention that by providing you control over the font name, size, color, etc.; it really goes beyond those combinations.  as you now am realizing, retaining font usage for caption gives greater resizing flexibility as well.

the white captioned button is actually hottracked before i captured this image to show you what it looks like.  the bigger one’s hottrack is not bolded while small one is.

  • and speaking again of the hottracking feature, when mouse enters the button area, the button will appear to have been pressed down to the right.  and along with that movement goes all the button contents: the button image, the line boundary if it is shown, the caption, and the icon (if any). it appears as a whole so i designed it to be treated as a whole during hot tracking.  when it looses focus or the mouse pointer moves away, it will appear depressed.
  • as shown in sstbnextgen, i changed tactic to avoid cluttering the class instance in a form with a lot of this and that, err… this and this!  it is parameterized now.  if your vfp version already has an intellisense feature, the class can take advantage of that like shown below:

with the help of intellisense, you will know exactly where you are and what is needed on that portion.  with intellisense working, your current position is shown in bold as can be seen on the image above.

err... that looks monstrous!  it seems very hard to use it!!!  really intimidating!

not so!  all parameters have default values, meaning you can leave those untouched and just simply put comma in its place to reach your target settings. all parameters are optional, except that you have to place any one of those settings to activate the class _settings method.  you can simply say:

this._settings("my caption and i am done!")

and that is it!  it will show the button with all the default settings (dragging the width a little longer to fit caption):

here are the parameters in order:

like what i have said with icons, you can position it anywhere as you will be the one controlling the left and top positions of it. if you haven’t put any icon name, then you can simply ignore top and left positions as well.

a few more last surprises:

  • unlike a plain image used as a button, this class can accept tab order.  not just simply accept tab order but retains focus as well.  not only that, it will do the hottracking as well like what will happen when you move the mouse onto it.
  • since i have given it the ability to receive focus as reflected by becoming hottracked, you can use the keyboard as well to move back and forth to several objects including this button class of mine, based on the tab order; very much like the native vfp command button.

very important (a repitition of what i said in sstbnextgen blog):

with my goal of lifting some weight off the end-user’s shoulder, there is one thing you need to do.  add the images i used into your project.  to do that, in project manager, go to other tab, then others, then click the add button and choose all the images i used for my classes.  you will not see the images during the development phase as those will appear on the final exe.


all i have used here are 100% vfp commands and i have tried my best to make this run on lower versions as well.  except with the images needed for the button, all objects in this class are 100% native vfp objects.

note:  since i decided to post sstbnextgen earlier than intended to to give myself ample time to reply to possible requests, i am likewise posting this now especially since i have given this as well to all who already participated so some of them i believe needs a guide on how to use this as this one has a lot of parameters.

advance happy new year to all!  i hope that this new class provides the intended boom to give impact on your vfp exes.  play with the possible combinations and enjoy!

ps.  i forgot to mention that you need to use clickaction click event for your commands (similar to commandbutton click event).

updates december 19, 2009 at 2:30pm:

additional features:

1.  just now i have added a hotkey ability to the ssbutton class.  so you can now make the caption of the button something like this:

this._settings("\<fuel voucher encoding module"). 

and the letter f will be the hotkey for that ssbutton instance. 

2.  additional keyboard functionality.   you can now use enter when it has the focus and it will perform whatever it is inside its clickaction click event. 

3.  when the instance of the class in the form is disabled (enabled = .f.), the hottrack color will be duller now instead of the default white or your chosen hottrack color so you can visually differentiate the difference between an enabled instance vs a disabled one.  in addition, since the command to be performed is outside of the class in clickaction click event, you have to trap the status of enabled property like this:

clickaction, click event:
if this.parent.enabled
   * put your commands here

in that way, when it is disabled, it will still hottrack but now with duller color and clicking it won't perform the commands it is supposed to do.

update: december 26, 2009

i already have submitted the classes for free and easy download to eric
for the download section of foxite, so you will see those pending the
decision of eric.  in addition, i have created a thread in coderisland
to have the same available for download.  please click on the link


3 Responses to Presenting SSButton Class

  • Vladimir Martinovski says:

    Buddy, you made me revamp my whole app. But I had to do it, now it look simply , gorgeous …? This will be final touch, or .. Maybe you will suprise me more ???

    vladimirm at fx dot com dot mk

    #Glad those make your app shine.  I honestly don’t know if those will be my final touches.  Most of the times, I thought this is it.  I have reached the max of my imaginations.  There is no more left. 

    That also goes with my contributions, I thought when I posted my 5th this is it, no more left.  And every time I post another, the same thing goes in my mind.  However my contributions are now now beyond 40.

    Anyway if I will make more enhancements on those existing ones, I will try my best not to touch that much the original designs.

  • Vladimir Martinovski says:

    Strange but I dont get anything in my mail box… 🙁


    vladimirm at fx dot com dot mk

    # Hello Vladimir.  I have made further enhancements on the class, please read updates above.  However, it is still in my project.  When I made a class, I made those inside my own project first so I can see how it will work and look like.  Then when I am satisfied, I isolate it for distribution.  Please wait a little more time as I have to update everyone who already this class and that, of course, will include you. 

    You can still continue using the first version as my enhancements will not affect anything you already have done on your end except enhance it.  Cheers!

  • Gaetano says:

    puoi inviarmi la tua splendida classe?

    qGaetano at libero dot it

    Grazie mille, Saluti dall’ITALIA

    # Sono contento che le mie lezioni ti arriveranno in Italia. Saluti dalle Filippine. Inviato al tuo indirizzo email, tutte e 5 le classi. Salute!

Leave a Reply

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