Welcome to Foxite.COM Community Weblog Sign in | Join | Help



Make your own title bars


Sparked by the recent request of one of my colleague in Foxite, I captured Google Chrome and created a title bar for him.  But since I want to give subject a Chrome Bar outright, I made a simple one and just implemented a simple trick including two sets of images and six shapes.   Then just gave a suggestion on how I think it could be made more flexible as I really have no time to play yet with my idea.

However, after I made that Chrome title bar for him, I found creating this blog more and more appealing as I think it will help members/readers to learn how to create other title bars of their own as well.  Thus when I came back in my accommodation earlier tonight, I started playing immediately with that idea.  And to make it really more flexible, I made it a class this time; so now I am giving you my Chrome Title Bar Class.  Just drag it into your form and it will autoresize based on your form's width on runtime.

Actually creating one’s own title bar is fairly easy.  I will briefly explain here how this Chrome Title Bar was made possible and the steps to do to create your own too.  I hope by the end of this blog, you will learn how to create a title bar of your choosing.  And I triply hope I am not violating anything by teaching you this.  Here it goes:

  1. Look for an appealing title bar used by any software by opening that software (in this case Google Chrome), then capture the screen by pressing PrintScreen button.  Now the entire desktop image is in your clipboard
  2. Open MSPaint and paste (Ctrl+V) it there.
  3. Crop the title bar, then break it into three segments
  4. Get the left-most part where the caption would be and save it as segment1.bmp
  5. Get the middle part (where in the case of Google Chrome, a pure blue bar) and save it as segment2.bmp
  6. Get the last part (control bar?  Where Minimize, Maximize and Close buttons is located) and save it as segment3.bmp
  7. Now when combined together, you will have the whole title bar
  8. Hover your mouse on the close button of the source title bar of your choosing so it will change appearance, once again capture screen and crop only that close button which by now is highlighted; then save it as CloseX.bmp
  9. Do the same on minimize and maximize buttons, save it to whatever name you want.
  10. Create three shapes, transparent, borderless.  Put those on top of minimize, maximize and close buttons.  Name it accordingly.
  11. Now we are done.  For the list of commands to implement, study my class.

Here is the image of the sample attachment:

And this is the title bar in action in my bbgsoft:



Afterword:  I have encountered a small problem, when minimizing the form and user suddenly decided to maximize it instead of restoring; as it cannot trigger the resize event of the class.  To counteract that problem, one command is necessary to be placed in the parent form’s resize event, i.e., calling the resizing method within the class itself.

I hope I have explained clearly the steps and tricks to be implemented for creating your own title bar.  As we all know, the beauty of the form starts on the title bar itself going down the form.  So, go on and start creating your own title bars now.  Enjoy!

P.S.  This class may still have some bugs as I only made it just now (no elaborate testings made).  So if any of you will find a bug and fix it, you can upload the fixed/modified class on foxite, inform me and I will update the sample here, of course with the proper credit to that person.  TIA!

Update 11/13/2008:

I added some more tweaks with the help of Cesar.  Bernard's suggestion and Kishore Kumar's will appear on future releases of this class.  Plus I will add some more themes.  So watch out for that!  I also updated the sample attachment here.
posted by sandstorm36 | 6 Comments
Attachment(s): chrome.zip

Conditional Sub-Total Printing


Just for a change I will venture into native reporting and give you a very simple trick on conditional Sub-Total printing.  There is certainly a need that you will present a report with sub-totals as follows:




However, isn't it looking dumb that even with only one record, we are presenting it like that (one record, still with sub-total)?  What is to total?  Not to mention wasting precious ink and papers. So today I thought I would play around with it and will try to remove sub-total on a single record per grouping and the result is this:







The trick lies with a variable.  Create a variable, name it to whatever you like (mine is overall), with the following settings:
Value to Store = 0
Initial Value = 0
Reset value based on a group
Calculation Type = Count

then of course, tick the Release after report checkbox.

Now, on anything that is in the Group Footer, double-click, click Print When tab, tick Remove if Blank checkbox, then place this condition on Print only when expression is true textbox: overall > 1

And that is it.  Enjoy your report with conditional sub-total printing!



posted by sandstorm36 | 1 Comments
Attachment(s): condsub.zip

Better Tooltip


Err... I am a little bit more free today so I am making blogs, LOL!  Next time I simply would not have the time.

This one I decided also to add to bits of things I want to share.  As I always say, who knows somebody might find some of my things useful?  Even the simplest ones.

So as I am saying, there is a trick for a better tooltip, i.e, applying CRLF as follows:

MouseEnter Event
Lparameters nButton, nShift, nXCoord, nYCoord
LOCAL CRLF
CRLF = CHR(13)+CHR(10)
If Thisform.grdInvty.Enabled = .T.
    Thisform.grdInvty.ToolTipText = "Tips:"+CRLF+"==="+CRLF+;
        "Single clicking a record will select that record, "+;
        CRLF+"Double-clicking sets focus to the quantity box. "+;
        CRLF+CRLF+"Clicking on the Headers/Titles will sort records in accordance "+;
        "to the clicked header!"
Else
    Thisform.grdInvty.ToolTipText = ''
Endif


Result:


Why mouseenter?  Because I wanted to turn ON and OFF that tooltip on the grid itself.  When the grid is still disabled (adding of new entries is not invoked yet), you can move around your mouse over the grid but tooltip will not appear.  Why not mouseover event then?  The difference with mouseenter vs mouseover is that whatever you want to be included in the mouseenter event will only takes place once, when you enter the object.  Mouseover, on the other hand, will repeatedly perform whatever is in that event as long as your mouse is over that object.

Just another simple idea that might add beauty to your app.  Enjoy!


posted by sandstorm36 | 1 Comments
Attachment(s): consub.zip

Retro Approach on Modern Interface


Every one of us these days is trying to make our app's appearance better.  And since MS declared no more releases for VFP, we strive to make our VFP app more competitive with other PLs in the market like .NET.  That means, adding new activeX objects, new GUIs, and a lot of "new" things.  Now the question is, do "old school DOS programming" approaches still have a place in this new way of developing an app?   Well, I am most certain that people will immediately say "Bleehhh!  That is an absurd question!  You must always give way for new development.  Why should I still implement my old school approaches when there are lots of new classes and objects out there?".  or "Are you kidding me? Get real!".

That is what I have tried to find out when I first implemented my retro look on a new GUI.  The very first person I always shared my ideas is my cousin Glen, and believe me or not, 90% of the time, we will not agree with each other because that is how we make fun of each other.  

And thus expecting that type of comments before even seeing what the heck I am talking about, I prepared something for him to see (which is now the topic of this blog). In the end though, he always admits that he really likes my ideas. Aside from that, we do exchange each other's ideas.  Of course even though I am ahead on age and experience, he has his own ideas too.  And of course, each and everyone of us needs to be convinced first before we agree to a certain idea.

So let's get to the point.  What exactly is this retro thing I am blabbing about again? Let's take a look at how most of us approaches our app's appearance:




Viewer: "Oh... kay....  What's the problem with this?  It seems just fine to my eyes".  
Me: There is absolutely nothing wrong with this.  That is how it is supposed to look like according to my needs. 
Viewer: "Then what the heck again are you talking about?" 

(LOL!  I am loving this first person - second person conversations scenario!).  What I am talking about is I decided to add a RETRO effect on this form and the result is better (at least to my taste) than what is shown above.  The modern approach is to use textboxes to emphasize the selection displaying some details not shown in grid.  And one textbox means one field.  With old DOS approach, we do it like:

Local CRLF
CRLF = chr(13)+chr(10)
@ 5,0 say padr("Item Description",30)+": "+alltrim(mytable.descript)+CRLF+;
          padr("Barcode Number",30)+": "+alltrim(mytable.barcode)+CRLF+;
          padr("Last Price",30)+": "+alltrim(transform(mytable.lastprice,"9,999,999.99"))+;
  && and so on...

I used the same approach on items for viewing purposes only but instead of directly placing the output, i have to put it in a single variable first then used a single editbox to hold the value of that variable, and presto:  All those details in a single edit box; data are properly aligned and does not strain the eyes because the eyes does not stray away from that single object.



Benefits:

- less objects to maintain (a single editbox as against multiple textboxes and labels)
- Cleaner appearance.  One rule I always try to apply and to share is make your best to organize properly the appearance, try not to place too many objects that can add confusion to users if it can be helped, and try not to let the eyes of the users be strained.  The latter can be achieved by diminishing the effects, colors and highlights of other objects.  It is straining to the eyes to see several objects which have strong colors or is demanding attentions simultaneously especially if those objects are scattered all over the screen (if it is grouped to one side, then i guess it will be ok).
- Are there more? Maybe.

One thing before i forgot again, when applying this trick, it is better to use Courier New font to make sure that the characters will be aligned properly (like DOS plain text or draft font).  Finally take a look at this one (Don't worry, all entries are fictitious, no animals are harmed or killed on the making of this blog):




Per request I received in my email, i now attached a sample form.  Enjoy!
posted by sandstorm36 | 3 Comments
Attachment(s): retro.zip

Skinning your app

When I created my first blog, among the topic that I promised is skinning.  However, I cannot find a good yet simple sample to use so I said, never mind.  But lately I decided to add new skins for my mobile so I mused, hmmmm….. this can be used for demo on skinning one’s own app.  So here it is!

The idea of skinning my apps came from an offhand comment by one of my co-managers here because I design appearance based on my moods, and my moods on that time is to make colorful backgrounds (now I am back to plain, less colorful backgrounds for my sub-forms) so I made one and showed it to my co-manager here expecting something like “Hey!  That looks cool!  How did you do that?”.  Yet to my dismay, what he told me is “I don’t like the color!”.  I asked “Why?  It looks cool to me?” and the immediate response is that “I just don’t like it!”.  So I asked him, what color do you like?  And he told me “orange”.  The color I used for my original design is, of course, blue.  Here you can see that everybody has his own unique taste.

To make the long story short, I decided to create several backgrounds for my app because I honestly like blue but since he doesn’t like it, I created another for him.  Thinking some other people would not like those colors too, I added 3 more.  Then I used optiongroup buttons to switch skins.  And everybody’s happy, because the user can retain the colors he/she wants per module.  Then when they get tired of their picked color, later they just switched to another color (which will be retained again per user account) and it really does help change the mood of the user.  Below is a single form with different colors:




But that is not the real sample I gave here, I wanted something that will work like winamp or media player where the objects will move around (the one shown above retains positions)  and resize depending on the skin.  And so, I decided to use mymobile once more which is one of my blog topic before (placing various images on grid) as once again I get tired of its original appearance.  And here is mymobile again with 3 skins:




One beauty of skinning is it reduces exe size because the skins can be excluded in the project and assigned in the Init event, though it is hard to move around objects without the skin or background picture as you will not have a guide to know if you are placing an object on the desired correct position or not.  So what I always do when I really wanted to incorporate skinning ability is to use a skin first as background, move around objects, then once satisfied remove the skin and later programmatically calls it.  That will, in effect, exclude those huge images from the exe itself.  Also, just for fun, I always rename my skins' extension from .jpg to .skz, .bmp to .skb and .png to .skx (that is if i plan to ship it out along with my exe).  Why? First it adds mystery (huh? is this a new format? LOL!), and second it is not good that when user browse your folder's app to see the images there.  With this trick, Windows will not autogenerate a thumbnail. 

Remember, when you exclude something from your project, you have to include it back on distribution time.  So when I distribute my app, I have to include the folder named skins.

Anyway, just see for yourself how it can be done (again natively).  Enjoy!

Here is the sample attachment: 
posted by sandstorm36 | 9 Comments
Attachment(s): mymobile.zip

ala Silverlight?



This blog will not deal with hardcoding or anything of that matter.  This is something about designing the appearance.

 If readers will observe, my blogs are focused mostly on some simple things which is very easy to achieve (requires only a good imagination and a little bit of patience) yet which might be useful or might give an app a feel of “coolness” of some sort.

Most of the times when an idea hits me and when I think it might give an impact to any of my apps, I put it into action.  This morning, I felt I needed a new look with the appearance of my Purchasing Module. The previous appearances are already, IMHO, cool but then my motto in designing the appearances of my apps is that if I get tired looking at it, then it is really not that good looking.   Here is one of the previous “looks”:




As I said, the appearance lost its touch with me.  And so I said to myself, make a treeview (I have seen some  people using that before) and use it as the menu for a change instead of always using CommandGroup button.  But in addition to that, I decided to make an additional look and feel, i.e., ala Silverlight of some sort (with thumbnails).

And so, my latest design is made.  I have encountered a  problem about the treeview getting disabled upon returning to the main form coming back from a sub-form called, but was able to solve it with the help of  Anil Sharma, Samir Ibrahim, Stefan Wuebbe, Cetin Basoz and Jorrel Detaunan (many thanks) inside the Foxite forum; Thread ID:  190840.  But that is another matter.

In order to achieve the trick I planned, I captured the images of my sub-forms by pressing “print screen” button, pasting it to MSPaint and resizing the images between 30 – 40% (Ctrl+W, Stretch/Skew).  Then saving it later to a sub-folder I named “thumbnails”.  Then on the main form, I added an image object to hold those images and changed pictures by issuing:

Thisform.Image1.Picture = <the target picture>
* Of course, you must change <the target picture> with the complete path and name of the target picture.  I used a variable to hold the changing of the pictures, values are based on the table I used in the treeview itself.  Here is the effect:
















I just wish to impart this new trick to give readers another idea on how to give a new look to your apps.  It is unlike the works of Cesar, Bernard Bout, Carlos Alloati, Emerson Santon Reed and Craig Boyd to name a great few, who gave their work to us in a silver platter, i.e., a class or something like that.  This one, I am just giving any interested person the "how to do it yourself" so you can make the same thing if you are interested.  But it will still require some work on your part as the thumbnails will be based on your own form designs.

I hope some will find this useful. Enjoy!




posted by sandstorm36 | 5 Comments

Placing Various Images on a Grid

Here I go again.  Another interest caught my attention, this time about creating a listing of my contacts.  I really am very forgetful with these matters.  I have these lists placed before on a Page Frame, each with its own grid.  But since I played last time with treeview and was able to make it run, I said to myself, yep, I will make my contact lists look sleeker and create a treeview for that too.  However,  I thought later why not put it in a mobile phone image instead to make it appear more realistic?  That would be cooler!   

But we were straying off the topic, this is not about irregular images. For that just look at the Solutions sample.  Once the Mobile image is in place, I debated whether to use listview or grid (treeview is out of the question, can you imagine a mobile with treeview?  What the heck?!!!)

And since I always am in favor more of a grid (with VFP9) than listview, grid it is.  Now the problem starts, there is no DynamicPicture!  Huh?!!!   Quoting from Marcia Akins  - "with grid, there is  only one real row; the rest are just mirrors and smoke screens!".   So if you choose an image, it will be applied all throughout the rest of the grid; that is why the need for DynamicPicture.   Why didn't VFP Team thought of that?  The answer is because as Mike Yearwood fondly says, "there are various ways to skin a cat!".  And there are indeed ways.  One is the real topic of this blog.  It is called DynamicCurrentControl.

I decided to make this blog a tutorial of some sort instead of me always attaching a sample.  Just to make this different.

a)  So what is CurrentControl?  CurrentControl property is used to specify which control contained in a column object is used to display and enter the values of the active cell.  Default is textbox.   Now, control is not only limited to one object.  You can add as many objects within a column but VFP can only have one current (active) control at a time, i.e., CurrentControl.

b)  How can we then show all the results when there is only one current control at a time?  Here, Sparse property will come into play.   Sparse, by default is set to .T.  but setting it to .F. will do the trick.  With Sparse = .F. , ALL cells (not only the active) in the column object will use the CurrentControl property setting to display data.

c)  What is DynamicCurrentControl then?  It is just the same with CurrentControl with one exception.   It is dynamic (changing).  Applying DynamicCurrentControl property in a column will instruct VFP to re-evaluate the values of EACH cells for every refresh of the Grid based on your conditions.  So you can change CurrentControl in a column more than once, excellent!  Just what I needed!

We needed the three properties mentioned above to achieve the trick on creating a grid with various images.  Here goes:

To display an image in a cell, I cannot do that with the default textbox as the current control.  I needed an Image object:
1.  Use the properties window and navigate to the desired column of the target grid, in my case, Column1 of Grid1.
2.  Click on the image object and then click on the grid.  That will place another control on the target column which is now an Image object, aside from the default textbox.
3.  Remove the textbox by navigating to it using again the properties windows.  Once you are in Text1 of Column1 of Grid1, then click again on the grid and press delete.
4.  Add more Image objects using step 1 and 2 above.  Add as many as you need (in my case, I only wanted 4).
5.  Put your desired picture on each images programmatically or by using Properties Window.
6.  Go back to your target column using again properties window and set Sparse to .F.
7.  Click on the DynamicCurrentControl.  In my case, I have a table with the following structure:

PHONES.DBF
ContactName  C(30)
Details           M
IconUsed       N(1,0)

Since I only desired 4 different icons to appear, in DynamicCurrentControl I placed this:  ICASE(IconUsed=1,"Image1",IconUsed=2,"Image2",IconUsed=3,"Image3","Image4")  
An alternative to that is to create a method within the form then do the switching there, let us say a method named ChangePix.  Then in the DynamicCurrentControl, just type Thisform.ChangePix()

8.  Create several records, place different values on IconUsed field and run the form.  

There you are!  A grid with different images.

Here is the picture of MyMobile v1.0.  I am planning to do a sleeker version when I have time, one with icons inside the screen like the latest mobile phones these days plus making the keypad works. But for now, this works just fine.




I have attached the mobile zip below.  Please extract it to C:\Samples.  Enjoy!


posted by sandstorm36 | 2 Comments
Attachment(s): samples.zip

Native Spinner Dates

Well it has been long time since I last blogged so I said to myself, create some again.  This one is very simple indeed, but if my way of approaching things like in MyIntro form is not known and became useful to some members, who knows about this one?  Maybe these two simple things can also help others?

Let us find out!

Spinner Dates:

I was under the impression that there are still members using either a plain textbox for date entry or a popup/dropdown calendar of some sort.  Plain textbox for dates is ok but that is it, it is very plain.  ActiveX calendars are cool, but in some cases might not be warranted.  Or might give you headache registering the dll to the cpu to be installed.  An alternative to popup calendars are spinner calendars, but why use ActiveX for that when it can be done natively?  

Here are Native spinner date and spinner month.  I hope someone will find it useful like I do.  Once again, enjoy!

Note:  By default, my spinner date will increment/decrement the day.  If you want to increment the month or the year, you have to click it first.

posted by sandstorm36 | 1 Comments
Attachment(s): spinnerdates.zip

Taking command of your Agents


Don’t you get tired of seeing Merlin or Genie on all other apps?  Haven’t you wished to use other MSAgents for your own app to make it a little bit unique?  Or have tried, but got stuck in the process because the commands shown in the example is not working or is ignored by other MSAgent characters?

 

Well worry no more, this blog (it sounds more like a commercial, LOL!) will teach you on how to properly mobilize your agents.  The trick is, like any other agents (that includes militaries); you need to know the commands like “JUMP!” where they will have to immediately respond “YES SIR! HOW HIGH?

 

There are two ways to do that. Both needs “Working with Microsoft Agent” sample provided by Solution:

  • Programmatically modify the names of the agents inside.  Let’s take a look at the button captioned “Merlin” (named cmdMerlin).  On click event, it has these commands:
                      If thisform._agent.load("Merlin","merlin.acs")
                            thisform._agent.setActiveAgent("Merlin")   
                            thisform._agent.show(Rand() * 400, Rand() * 400)
                            thisform.lbxAnimations.Requery()
                      Else
                            =MessageBox( MERLIN_NOT_INSTALLED_LOC, MB_ICONSTOP)
                      Endif

                      If I want to use my nasty dog Rocky, all I needed to do is to replace all instances of “Merlin” with
                      “Rocky”, but make sure that Rocky is properly installed otherwise it will not take effect.
  • Easier way, open Explorer, go to WINDOWS\msagent\chars and paste your characters there.  Now, rename Merlin.acs to Merlin2.acs.  Then copy Rocky.acs to Merlin.acs.  Now you are fooling the sample to think that Rocky is Merlin.

Doing any of the above will now give you what you wanted, i.e., the commands for that particular MSAgent character (every character has its own sets of command).


 One more thing to wrap this up, the magic word is needed:  Enjoy!

posted by sandstorm36 | 8 Comments

Simple way to create an intro form

I have posted this inside foxite forum under Thread ID: 174675 and have completely forgotten about it, until today when a member requesting help have made me remember this. And so, I now decided to include this among my blogs.  Excerpt of the original post follows:

A very simple way of creating a form for user login name and password

During my early years of developing an app with VFP, the need to create a login form to validate user logins came, and so I created one that I am still using up to present. I was able to create it within just a couple of minutes so I never thought more of it. Until by trying to help members here, I was surprised that the concept I used is not what I thought it would be, i.e., standard approach.

And so conversing to newfound friends in foxite via Yahoo Messenger, it was brought into my attention that unless I show how it could be done in words and not only in picture, the approach I made would not be understood by some. So, thinking that in a way some members might benefit, I decided to create this blog to elaborate the tricks I implemented to arrive at a login form. Actually, creating one is very simple, here it goes:

The first thought that struck me when I needed some login form, a small one somewhat similar to Windows Login form that will determine if the user can go in my app or be kicked out immediately, will be to make it appear on its own without any VFP window lurking in the background. So my immediate thought was to hide VFP main window, but then changed my mind later to just move the main window out of the way.

MAIN.PRG

 Modify Window Screen At 70,50 SIZE 0,0 TITLE "Security"



But by moving VFP main window out of the way, my form is moving along with it. So how can I make my form independent of any Window in VFP? The solution lies with creating the intro form with Desktop property set to true:

On Intro.Frm:

     Thisform.Desktop=.T.



But then, it just blinks. Wait I forgot to make the form modal:

     Thisform.WindowType = 1



Now we are all set. All that is left is to add picture background to make it look good and then two textboxes to hold the user login and password entries. After completing the above, the result would appear somewhat like shown below:


Now, since the purpose of that form is just to allow or disallow users, I decided to use a variable which will eventually hold a value of False or True. This will be the basis later on proceeding with the main form or not.

MAIN.PRG

    m.CanProceed = .F.
    Do Form IntroForm


Then on Intro.Frm, create your own necessary validations. If both the username and password tallies with your record on a table that holds those information, then change the value of the variable m.CanProceed to True and exit the form using release thisform. Use also ESC key to release form but do not change the value of m.CanProceed as that is equal to aborting login. So a successful logging or pressing the escape key will trigger the form release (release thisform) and will return focus back to main.prg.

Next, (back in main.prg) evaluate the current value of m.CanProceed. If the new value is True, proceed with your main form, if not, exit your app. But before you can show your main form properly, you must restore VFP Window to your desired settings. I am using the settings below on a fixed screen size of 1024x768:

If m.CanProceed
        Modify Window Screen At 0,0;
            SIZE 34,85;
            FLOAT;
            NOZOOM;
            TITLE "BBGSoft";
            COLOR N/b;
            FONT "Courier",16
        * Now load your real main form
        Do Form MainForm
Endif
Close All
Release All
Return



Just a recap, I will now combine all the commands without the explanations to show how simple really it is:

m.CanProceed = .F.
Modify Window Screen At 70,50 SIZE 0,0 TITLE "Security"
Do Form IntroForm
If m.CanProceed
      Modify Window Screen At 0,0;
            SIZE 34,85;
            FLOAT;
            NOZOOM;
            TITLE "BBGSoft";
            COLOR N/b;
            FONT "Courier",16
            Do Form MainForm
Endif
Close All
Release All
Return


And we are done!

I believe that the above steps are fairly easy to do, and I hope that some of you will benefit from the above.

Added -  June 19, 2008 5PM:  I have attached a sample here so it is better for everyone to see how it is done.

Added - June 19, 2008 @ 10:09PM:  I created a complete sample now, with the dog and a background.  I still was not able to upload it so I sought the help of our friend and colleague, Samir Ibrahim (many thanks!).  He has posted the downloadable sample under his own site.  The link graciously provided  is http://www.cdcity.org/junintro/myintro.zip


posted by sandstorm36 | 3 Comments

Smart Backup Enhanced Version


Smart Backup version 2

I have created a makeover to show how the power of imagination when properly applied can turn a simple concept and object to a better and appealing one with NativeBarX.  And the immediate responses are better than the first one.

So it is just fair for my Smart Backup to also have the makeover.  I actually planned to rename it also as Smarter Backup but I fear that I may be going overboard with that one, LOL!  But still, if I have used that name and some member again complained, I can just simply say "because it is smarter than the first release, LOL!"

So here it is now, the rebirth of Smart Backup with a few tricks added.  You must  extract contents inside c:\SmartBackup folder, if you don't have it, create it.  Or you can extract this one and rename the folder later as SmartBackup.

As I notice I always say in my previous blogs, Enjoy!





Update November 27, 2008:

I forgot to caution readers that if you will be using this to backup "live" data, you might want to follow the exchanges first on foxite to get a better understanding of the concept.  If you will simply use this as the standard backup where everybody is already logged out, then just download the sample, attach it in your project and that is it!

posted by sandstorm36 | 2 Comments
Filed Under:
Attachment(s): smbv2.zip

Introducing NativeBarX

VFP NativeBarX

I was very surprised with the response I received with my VFP Native Progress Bar in my Gmail account.  I never expected that simple bar will generate that reaction from members of foxite.  And so, that progress bar which I seldom pay attention before now received further enhancement from me in the way of GUI.  So last night, I played with it again and let me introduce to you now the newly improved Native VFP Progress Bar.  It mutated into NativeBarX (it is still not an activeX but again, I want to call it like that, LOL!)

The sample I attached here are just that, sample.  As I've said before, it can be eXtended to suit your needs (visually) and so you can also continue playing with it.  Attached herewith is NativeBarX.zip, you must extract it to root folder c:\  otherwise you need to point the picture location of the car and the comet yourself.

When I have new ideas and when I have more time, I will create some more for those who will be interested in using my NativeBarX. So watch out for that!

Again, enjoy!
posted by sandstorm36 | 3 Comments
Filed Under:
Attachment(s): NativeBarX.zip

Smart Backup (Backing up of Live-Data)

Backing up of Live-Data

The last time I created my very first article here in Foxite, Ken Murphy volunteered to be my editor, and that gave me a brief direct communication with him before he passed away.  One of the advices he had given me is “try not to kick out users when doing backup!” (not exact words).

Also, when I began contemplating creating a new backup method with that concept, the words of one of our colleague also echoed in my mind “I use text file to create a backup – Christian Tabligan”.  So I likewise considered it for my new backup.

However, before I can start hardcoding of the new backup method, I immediately realized several things:
  • If I follow Ken’s advice to create temporary tables in my local drive to hold the data that is currently being used (live-data), how can I backup memo files?  And how about the indexes?
  • If I go with Criz’ suggestion, the same problem arises.
And to do those things, I need to know beforehand the target tables as well as the related indexes and memos.  How about the reports (some of us include reports in the shipment of our apps).  So with these things considered, the approach that Ken and Chris suggest, IMHO, will not be sufficient to what I want.  I can work around it but then it will take longer encodings.

And so thinking of how to do things the way I wanted, this theory came to my mind, and after that, the hardcoding, then the testing stage.  And between me and two other person, this seems to perform well and so I now will share it with you.  I call it Smart Backup (Do not protest, I made this one so I can call it whatever I want Big Smile [:D] )

The concept behind this revolutionary (LOL!) backing-up procedure is to copy the target files locally, then from there create the compressed file.  All of the commands I used here are pure Native VFP Commands, with the exception of WinRAR.  I chose WinRAR here over my recommendation in my article which is VFPCompression.fll in that I wanted a progress bar to reflect the work being done.

One of the reasons also why I created my very first BLOG is because I want to introduce first the concept of Native VFP Progress Bar (which I am using since Clipper days) as I applied that bar also here.  I believe that those who read my BLOG about that are now familiar with it, so they will no longer pay attention to that on this new backup of mine (if they are not yet familiar with that progress bar, naturally it will add confusion to this new form I am attaching here).

As I’ve said, I want users to see the progress of the work being done, otherwise, they will think that compression method is slow or that the unit has frozen.   I learn a lot on observations, and I observed that once you remove notifications by way of WAIT WINDOW NOWAIT or progress bar, or status bar; then the background jobs seem to be very slow (when in reality they are much faster).  Visual progress fools the eyes and mind of the users.

PS.  To have a better understanding of the concept, please follow the exchanges in Thread ID: 175768

posted by sandstorm36 | 1 Comments
Filed Under:
Attachment(s): smartbackup.zip

Graphical Analog Clock


Adding a Graphical Analog Clock in your form


This technique is actually not mine; it is from Glenn Villar, my cousin.  I introduced VFP to him sometime in 2006 because I have seen his potential in the field of programming and I don’t want such talent to be put into waste.  So I taught him my unorthodox way of doing things which mostly came out of experimentations and he showed also some innovations that came from his own experimentations, this one is among them.

So when Mike Yearwood asked me about this, I have to consult Glenn first because IMHO, it is his property so to speak.  He is younger than me and I am his mentor but then, I always respect and honor individual rights.  Also, I have always been an open minded person that is why I was able to do some things.  I not only listen to experts; newbies have some cool tricks of their own because their minds are still ripe for experimentation.  This blog certainly proves my point of view.  Some ideas pops out in my mind due to comments I received even from younger ones.  Needless to say, this BLOG is dedicated to my younger cousin, Glenn Villar, a proud foxite member.


That clock is a shockwave flash object we converted using Swissmax movie sample.   But for you to modify it, you have to have Swissmax or similar software that can recognize the format.

You can download a demo version of Swissmax2 on http://www.swishzone.com/downloads/SetupSwishmax2.exe so that you can play around and modify it according to your taste.  The size is 22.48mb and it includes a lot of samples. 

Earlier in 2006, we design some sort of advertisement on our forms (some sort of marquee style effect) but then found it less and less entertaining in the end.  Until we totally discard using those and retained only the clock on certain modules, if warranted.

Now going back on how to attach those in your form, follow these instructions:

  • Copy any of those shockwave flash object into your app folder or wherever you want (it is preferably in your app folder because you need to ship it with your app, only the .swf file). 
  • Add an activex ole control in your form, choose Shockwave Flash Object. 
  • Then simply type in the movie property your complete file location like “C:\bbgsoft\extras\thisclock.swf” without the parenthesis.
Click this for a sample.




Imagine the list of possible things these movies can do to beautify your apps.  But then overdoing it might result to some migraine on the part of the users.  Not to mention that in some cases it slows down refreshing of your form.  So you have to be selective in what you include.

Those shockwaves already have the necessary coding inside so there is no need to do anything anymore but just to recompile, sit back, relax and once again enjoy the show!

posted by sandstorm36 | 3 Comments

Native VFP Progress Bar

Hi to Everyone,


This is my first BLOG and I hope you will find some topics inside here useful.  I decided to create a BLOG for small bits of info that might or might not be beneficial to members. Some of the topics I am planning to include are:

  • Creating Native VFP Progress Bar (which is our topic now)
  • Skinning your own app
  • Adding clocks to your form
  • And anything I can think of later....
So to start with, and have a little effect to begin with, let’s mimic some famous words in sports entertainment.  ARE YOU READY TO RUMBLE!!!!??

 Creating Native VFP Progress Bar


As I repeatedly have said, I worked solo before and have no one to turn to when I have to do some things, i.e., before I found Foxite.    But running without a pack has its own advantages as well; you learn to hunt on your own and you learn to become creative with the best of your current level of ability.

Having said, I am not that yet familiar with ActiveX that time but I really wanted something to show the progress of my work.  So, what am I to do?  I cannot make ActiveX progress bar to work for me, would I leave it like that?  No, no, no!  And NO!  Big Smile [:D]


Solution?  Create My Own!


One of the advantages of creating your own progress bar is you have complete control over it. You can choose the color you want with the progress bar (ladies, it is now possible to have a pink progress bar), you can make it vertical and move things downward instead of upward, and a lot more....  You can make it unique according to your preference.

In making your own progress bar, you need three objects:

   1. A container to hold the progress bar and the percentage of completion (also container has the sunken effect)
   2. A shape to serve as the progress bar
   3. And a textbox to show the progress.

The shape’s width will start from zero and will expand according to the percentage of completion.  The percentage of completion will vary with the records.

I was planning to explain it more but it just came to my mind that oh boy, this will become lengthy.  So I presume that it would be easier for everybody concerned including me to just attach a sample.  So here is an example.  Feel free to use it and modify according to your needs.  Enjoy!

http://www.foxite.com/uploads/e56586fa-e4fd-4516-92d1-92c32295a099.zip

posted by sandstorm36 | 4 Comments
Filed Under:
Attachment(s): nativeprogbar.zip