Friday, December 28, 2012

ssTransparent + ssClose


As I am in the mood these days to create transparent irregularly shaped forms, I decided to work on another module on my end to give it a better appearance.  So last night I sat infront of my laptop ignoring my lovely wife designing yet another transparent form for that module playing with Daryl Bautista's Photoshop's styles script (many thanks!) and tweaking those a bit.

Then another thought hit me because I fail again to duck.  How about combining both ssTransparent and ssClose classes so I can have a cool close button in no time at all?  After much moving and styling of layers for the image to be used as the background and playing with ssClose settings, here is the result:

Friday, December 21, 2012

ssThrobber

Note as of December 28, 2012:

It was reported to me that ssThrobber do not work on others.  And when I checked here, it is only working on my machine but not on the rest of my users.  So here is a fix to make it work on your end.  You should register ssThrobber:

Step 1:

Click start button, run. Browse and look for where ssThrobber.exe is in you computer (d:\ssdemos). However, do not click OK yet and type a parameter /automation. Then click ok button and test again.

In the run box should be something like: 

d:\ssdemos\ssthrobber.exe /automation


Step 2:

Copy paste these into a notepad. Then save it as ssthrobber.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\ssthrobber.animate]
@="ssthrobber.animate"

[HKEY_CLASSES_ROOT\ssthrobber.animate\CLSID]
@="{051DF0CF-6D3F-4CE2-A04D-F11318866286}"

[HKEY_CLASSES_ROOT\ssthrobber.animate\NotInsertable]


After it was saved, double-click it.  That should fix the problem.


===============

Remember the throbber idea I shared last time in Weblogs?  Well it was reported before that during heavy processing, the animation stops.  Lucky for us Bernard Bout has showed another way on how to utilize that throbber by making it an exe and calling that from within our app.  Being that is now running on a different thread, then it is no longer affected by heavy processing on our app.

Following his instructions and codes, here is how to use that separate exe on our end:

local loThrobber
loThrobber = CREATEOBJECT('ssthrobber.animate')
loThrobber.Show

* Do your SQL SELECT here or any processes that will take long

loThrobber.Hide
loThrobber = Null

Very simple to use.  Just make sure that you copy that ssThrobber.exe where your app is.


This will be included likewise in the next upload together with  ssClasses library.

Also, if anyone who has a good throbber in their end would be willing to share theirs, please email me those so later I can put some more options such as changing the throbber to appear, etc.


Thursday, December 20, 2012

ssClose

ssClose 1 to 3 are just a small image that serves as the exit or close button of your form.  Please see previous posts regarding those.

ChangeLog as of December 20, 2012:
  • I accidentally removed form pinning capability via user interaction on ssSwitch.  Fixed.
  • Changed previous skin because it now looks "bland" to my taste.  Created skin # 2.
  • Added nSkin parameter in the end with default value of 1.  Right now it only has two values, i.e., 1 or 2.
Here are the current skins:

ssFader class

Here is a new class that will give you fading capability on your forms.  This has been mentioned to me the other night by Daryll Bautista saying maybe I would like to create a fader class.  And I told him that is a great  idea which I have not thought of myself.

So in the next release of ssClasses library which is planned this week, expect ssFader.  This is a control class with spinner.  And like some of my other classes employing ssSkinner class like ssTitlebar, this one also retains the user settings as well.  Meaning, when you go back to the form where this is dragged, then you will be coming back from your previous fader setting.

ssPolyClock Enhancements

Just to set the records straight, co-author of ssPolyClock is my cousin, Glen Villar, who also has his own blog (Reporters' Assistant) is the one who originally programmed this analog clock to run based on polypoint manipulations.  He volunteered this class last time to be included in my library so I incorporated that into ssclasses and added the move-anywhere functionality, skin switching and other more features plus of course the early skins; to make the appearance look better.  But the engine to make the clock work is his.  So let us give the guy the proper credit.

Another pinoy is making and will be making more impact on ssClasses library.  He is Daryll Bautista (known inside foxite as yllrad atsituab), a fellow foxiter and working as Tech Support, Developer and Designer in our country.  A very young man, currently only 22 years of age who lives in Tacloban City in the Philippines.

I noticed inside the forum that he is good in GUI so I talked to him behind foxite if he is interested in lending his designing skills to us to give ssClasses library better appearances on the next release(s); and lucky for us he has agreed.

Saturday, December 15, 2012

ssTransparent Class

Lately I am into creating irregular transparent forms (again) that I decided to create a class  instead of me repeating creating properties and methods and placing codes in each form I wanted to be transparent.  And said class is working good on my end.  Aside from making the form transparent, it will also make it movable.

Here are the steps to use this class:
  • Design an image in photoshop to be used as background.  The background color should be RGB(0,0,64) because that is what I use on my end.  Save it as bitmap.
  • Create a new form or open an existing form then set its Picture property to that  bitmap image
  • Drag ssTransparent class and drop it into that form
  • Change form's ShowWindow property into 2
And that is it, just run your form and see that portions of your form will become transparent based on the image you used as form background that are of color RGB(0,0,64).   In addition to that, your form will also be movable.

Friday, December 14, 2012

How to hide codes in your class?


ssClasses has gone from an open source library to per subscription with hidden codes and back to open source library.  And it cannot be helped that some are wondering how I was able to hide the codes before, and so a question raised inside Foxite.

And so I believe it is better for me to explain here the process involved in hiding the codes.

How was I able to do that?

Since I am using ssClasses library on my end in actual production of my ERP app, the codes are always visible on my end.  For my subscribers then, I keep a separate folder named ss_sample - subscribers; where a small project is made just like what you see now in ssDemos.zip with all the forms to show how to use each class and a copy of the library is there. And by intention, I have hidden the codes to them because I do not want them to touch it and then come back to me complaining 'Jun I have a problem, your class is giving me error!' where it will be hard for me to trace what has happened especially if it is because they touched my codes and forgot to tell me so.  To avoid that problem, they cannot touch my codes by making it invisible to them.  Any thing they need or wanted before, they suggest to me and I do any enhancement on my end, then email them back with new updates.  That also works good for every one because the updates are not limited to that single user, new features will also be made available to others.

So how did I hide the codes?

Thursday, December 13, 2012

ssClasses Library now in VFPx


ssClasses is now made public as open source at VFPx.  The initial release though does not involve ssButton and ssTitlebar yet being that those two are dependent on ss_support.app for the image requirements; the process  I decided to discontinue.  However, expect that those 2 will be added there in the near future.

As for ssClasses library, I welcome interested parties to participate in enhancing that library.  You can either email me suggestions or if you would like to work with me on that directly, send me an email as well.  In the tradition of CodePlex and of course VFPx, the library is now without any restriction from me.  And since the codes are there now, I know we can all make it better still!  My email allotted for this is ss.classes.jun@gmail.com


Here is the link of the project in VFPx:  https://vfpx.codeplex.com/wikipage?title=ssClasses&version=6

You can check the download link from there.

For my existing subscribers, I would like to say a very heartfelt Thank You to you guys!  Your contributions has helped me as well as others whom some of those funds from your contributions has already went to and the rest will still go in the future.

And I can't help but be amused that the first time I started working on the initial classes and decided to share those inside Foxite forum was in December; and now it is December again.  So, once more, Advance Merry Christmas every one!

Special thanks goes to Doug Hennig, Rick Schummer, Craig Boyd, Jim Nelson and Matt Slay for giving me the proper directions and assisting me in making this project available for VFPx.  

Special thanks also goes to Ony Too for his dropdown calendar class.  This small class has a very strong influence over ssClasses library.  As well as to my cousin Glen Villar for volunteering his Polypoint clock.  I just made that into the class adding some more features along the way but the engine running the clock is his.

Tuesday, December 11, 2012

ssExcelPivot class Enhancements

Changelog as of December 20, 2012:


Added two validations in ssExcelPivot, one to check if you have used a RecordSource or not, another to check if there is a record on that RecordSource; before allowing the class to proceed, again per request of MK Sharma.  However, the suggested usage for the class is something like this:

SELECT ....FROM.. INTO CURSOR whatever NOFILTER
IF _Tally > 0
   This._RecordSource = 'whatever'
   * And a lot more settings
   DODEFAULT()
Else
   Messagebox('Sorry, no data to process!,0+64,'Opppssss!')
Endif 

============


I am currently relieving our Fleet Manager  while he is on holiday so I am stuck here in our head office and is not going around in the meantime.  And because of this, I was able to focus a bit on my BizCore ERP app and can think of some more things to do for ssClasses especially on ssExcelPivot class to make our reporting lives easier.  And as I touch things when I needed those, I touch these now because I needed them.  Here are some new properties to give users more power and flexibility in generating their pivot reports:

_papersize = this is an integer value to select paper size, default is 1 or letter size.  When you use an invalid integer value, the class will default your pivot report back to letter size
This._papersize = 9  && A4 Size

_orientation = 1 portrait (default), 2 = landscape
This._orientation = 2

_withfooter = to show or not (default) a footer of Page 1 of x that is centered.  It auto-adjusts the bottom margin when this is set to .T.
this._withfooter = .T.

Tuesday, December 4, 2012

ssTextBox

Changelog as of December 20, 2012:


  • Fixed marker that is left behind when class is in focus and is disabled
  • Added _NoBackSpace property per request of MK.  When this is set to .T., you won't be able to go back to previous control using Backspace.
  • Added getting value directly from the class (forgot to add this last time)
===========


A subscriber surprised me yesterday afternoon by saying thanks in my email about my textbox class.  Where I said to myself, what textbox class?  So I checked and indeed there is an ssTextBox inside my library.  Then I remembered he requested last time for a textbox with curvature where I started working on it.  But then since other subscribers are repeatedly asking me to immediately release the latest updates of the library, after I have the basic need which is curvature, I left it and worked enhancing on the existing ones, sent the latest to them and then immediately focused back on my works in our company.   So ssTextBox remained to have only one feature, i.e., a textbox with curvature; no more no less.

While my said subscriber is happy with the curved textbox he has requested, he is now wondering how to resize that like what can be done to my other ssClasses class; which of course in this case is not there yet.  Realizing I have that unfinished class and suddenly feeling guilty knowing it is being used in production with only that feature, I told him I forgot about it and that I will work on giving it more features.  So last night, I decided to see what I can do further with it and I can say that now it is really worthy to be part of ssClasses:


Saturday, December 1, 2012

yv8g67.exe Malware Manual Removal


I saw the same activity on another unit but this time the infection is named bazirud.exe and is being loaded by toulobi.  In which case, I believe this is the same virus strain and so I cleaned it up with the same procedures I mentioned here.

Is your unit continuously uploading something like emails to internet when you are not doing anything like that on your own?  If so, then you may have been hit by this malware called yv8g67.exe.    I have posted this before on my defunct www.junblogs.com and while I forwarded some entries I created there before to here, for whatever reason I forgot to include this one.  Anyway, I will make this much simpler now.
What it does (minor things):
  • Creates several exe with random filenames inside System32 folder and marks it hidden, Read-Only and System. Sizes varies between 41kb and 44kb.
  • Further tracing shows it creates a backup/duplicate exe of all those inside System32 folder in the Local User’s temp folder, names are totally different than that inside System32
  • It also creates registry entries to HKLM\Software\Microsoft\Shared Tools\MSConfig\startupreg; to ensure that those virus parts will be auto-loaded next log on.
  • With the actions happening in the background with this virus, this results to unnecessary overpopulating of HKCU\Software\Microsoft\Windows\ShellNoRoam\MUICache entries in Registry
What it does (major things):

Saturday, November 10, 2012

Run a VFP app like a Service


Basic definition of a Windows Service is a program with no (or very little) user interface which provides programmatic services on the computer on which it is running. Real services though is registered in Windows' Service Control Manager Database and can be started, stopped, restarted, configured via   the Services mode of the Computer Management Console.

However, if your need is just like mine, i.e., a VFP app continuously running in the background just to do some things for my other app, then this simple demo which does not really put the exe among the Windows Services is enough. What it will do is create a system tray icon to tell you it is running, then run continuously and on a specific time (which I control via passing the time as parameter to make it more flexible) will perform something for you (whatever you want that is possible).

Friday, November 2, 2012

SouthWest Fox DevCon Trip, Through My Eyes!


I came back from this year’s SouthWest Fox DevCon last October 24, 2012 in Papua New Guinea but has to do a lot of fixing and troubleshooting back in several offices first so this delay in posting. Since some of my friends are curious about my experiences with the DevCon, I decided to create this post instead of repeatedly answering their questions one by one, LOL!  What is SouthWest Fox DevCon like, to me?

Well all I can say right now is attending this event has been very fruitful and my experiences very rewarding.  I won’t be too technical yet about these though as I haven’t begin reading thoroughly the white papers that I have received.  So allow me to just sort of tag you along with my journey.

My Time & Money’s Worth!

The main reason why one would want to go to SouthWest Fox DevCon is to learn new things.   But then, attending such convention will require some of your time away from your work or business plus will involve expenses for the trips and the seminars.  It is a given fact.  The main question in most of our minds then would be is “is it worth it?”.  I will say “absolutely” that it is definitely worth every cent and seconds you will pour into attending such conference.  Although Ceil Silver Funds financed my trips, should I be spending my own money then my conclusion will still be the same, it is absolutely worth it!  But make your own conclusions after reading.

Friday, October 5, 2012

ssExcelPivot Fixes & Enhancements


Fixed scrolling problem. Originally, when you click on the scrollbar, the class automatically assumes you are planning to do a drag and drop and repositions your mouse pointer into the topmost portion of the grid.  So scrolling can only be done before via clicking on the grid and using the mouse scroll.  Fixed that now.

Improved drag and drop.

Applied recent themes on ssSwitches.  Removed ssChkBox and replaced it with ssSwitch to give it a better look as well (theme 15).  Gave the popup for creating impromptu pivot reports a new, cleaner and better look.



I will update the subscribers when I come back from SouthWest Fox Convention with hopefully some more adjustments/enhancements. Cheers!

Tuesday, October 2, 2012

ssClasses New Features

ssExcelPivot Class


Added backward compatibility tested using Excel 2000 for ssExcelPivot class.

Added Multi-Column values tested under Excel 2007.


For 2000, it will be shown row-wise:



ssSwitch and ssOptSwitch:

Four new exciting themes (Number 13 to 16)


Cheers!

Thursday, September 13, 2012

Proper Fonts for dot-matrix printers


I have been wrestling with finding a proper font for quite a while now for my dot-matrix printing needs utilizing a POS printer which I decided to use for our Trip Ticket and Fuel Voucher issuances.  The usage of a POS printer appeals to me because it saves money, paper, ink and time because there is never a need to cut a paper into several portions anymore, but the fonts I used to print those do not appeal to me.

Here is the output using Tahoma:



While the output is clear, simply looking at the colons you can immediately notice the alignment is not proper, and that is because Tahoma is a graphical font.  Not to mention that it prints slower because it has more DPIs (Dots Per Inch) than the DOS fonts.

Thursday, September 6, 2012

ssExcelPivot Enhancements

ssExcelPivot class  is among my underrated or maybe I can say the most underrated class of _ssClasses library.  But this is in fact one of the best and useful class I have created so far.  After I created this class, creating top managerial reports has never been soooo easy for me.  What does this class do?

ssExcelPivot class  is that simple small insignificant looking button as shown below (ssButton4) that can create instant pivot reports in excel with ease.  Its power lies with creating these reports with just a few switch, which is what you cannot do with any crosstab utilities or even when designing reports via .frx way.  Shown is the sample form given to subscribers, data coming from VFP Samples directory:



It creates 12 sample pivot reports in Excel (in my sample) just to show how things can be easily done.  However, you can create more than that, even hundreds of different format, styles, etc.  At the very bottom is Create Your Own Report which allows user the ability to create a pivot report in excel of their own choosing.

I said it is easy to use this.  So I will show below codes inside the sample form I give to subscribers.  First of all, create a cursor to serve as its recordsource:

Tuesday, September 4, 2012

Capture Portion of Image from Webcam


Are you interested in having something like a small application that captures an image from a webcam?  Just like when we get our driver's license where we simply stand on one side  then the operator says "hold still..." then later gives a thumbs up sign?  When the driver's license card is presented to us, we see that our face is snapped and cropped so it fits properly on said license.

Is this hard to do with VFP?  Not if you know where to look for tools already shared to us by others.

Wednesday, August 29, 2012

ListBox Trick # 1 - Files with Filtering

This again is based on a query inside Foxite. The question goes:

I need to get tables only have or start names as month1,month2.....
thisform.text1.value=getfile("month.dbf")

While GetFile() is yet another easy way to get a fullpath(), it is not flexible on the filename part; only on the extension part where you can use wild characters.  You cannot do this:

thisform.text1.value=getfile("month*.dbf")

As the asterisk there will be construed by VFP as part of the filename, and not as a wildcard.  Same goes with LOCFILE() and  PUTFILE()  where you cannot also use a wild character  on the filename.

Ordinarilly, the immediate thinking goes to these steps:

  • Use ADIR() to gather filenames starting with the word "Month" and with extension "dbf": 
 ADIR(laMyFiles,'Month*.dbf')
  • Create a cursor to hold the result and perform INSERT INTO .. FROM ARRAY laMyFiles
  • Create a grid to show the result, then put some more codes either on AfterRowColChange or Click events to transfer the result into the textbox


However, while that is one of the best ways to do those,  there is yet simpler way which is using the highly unutilized feature of listbox known as RowSourceType = 7.  It involves less coding and actually is very easy to use.  For the sake of this example, I will simply filter the list of files with all dbf:

Saturday, August 25, 2012

Combobox Tricks - Part I


I actually posted this or some of this in the defunct www.junblogs.com and has intentionally did not forwarded it in this blog  thinking it is already read before by most of my followers, so they know this now.  But several times I am still seeing some quires regarding comboboxes that I decided to revive this plus add some more tutorials in the near future.

So let us start again on combobox tutorials with this trick, hiding columns and some other things.

The way some developers do to hide let us say the 2nd column from view is to change that 2nd column's width to zero.  While it is good, there will still be a space alloted and shown for that zero-width column:


loTest = Createobject("frmCombo")
loTest.Show(1)

Define Class frmCombo As Form
      AutoCenter = .T.

      Add Object combo1 As ComboBox With ;
            RowSourceType= 6,;
            RowSource = 'junkcbo',;
            Value = 0,;
            BoundColumn = 2,;
            BoundTo =.T.,;
            Style = 2,;
            top = 50,;
            left = 10,;
            Width = 200,;
            ListIndex = 1,;
            ColumnCount = 2,;
            ColumnWidths = '200,0'

      Procedure Load
            Create Cursor junkcbo (xName c(30), xCurrency c(3))
            Insert Into junkcbo Values ('Philippines','PHP')
            Insert Into junkcbo Values ('Papua New Guinea','PGK')
            Insert Into junkcbo Values ('Australia','AUD')
            Insert Into junkcbo Values ('United States','USD')
            Insert Into junkcbo Values ('Indonesia','IDR')
            Insert Into junkcbo Values ('India','INR')
      Endproc

Enddefine


So to fix that problem, you have to hide the column lines to make it appear that column1 and column2 are just one.  Under combo1 settings, you have to add this line:

Friday, August 17, 2012

Spell Checking & Correcting Form Captions

Here is a little something that is asked just now inside foxite forum, i.e., how to get the captions of each objects inside a form, use Word's Spell Checking feature to correct those, and then update the object's captions with the corrected one.

While I do not know why this is needed, well we try to give what they request.  So here is a sample of how to do exactly just that via word automation:

Tuesday, August 14, 2012

Drag & Drop III - Moving Borderless Forms

I know there are already lots of samples shown by experts on how to drag a borderless form.  But just in case you wanted to see another simple way, here it is.  If you will be simply allowing dragging via the form's surface itself, then you can simply do this as shown in my codes below.  If there are lots of objects where you need to bind the dragging, like a fake title bar, the caption on that fake title bar, etc.;  then you need to use BindEvent().

The reason why I am sharing this is because my earlier approach is to use MouseDown() first to perform validation whether left mouse button is clicked, then call another user defined method like MoveMe().  What I wanted to show here is a more direct usage of an object's MouseMove() event.  You drag (move) things via the left mouse button, so use MouseMove.

Here are the codes:

ssClose3

Update August 16, 2012

Added the ability to pin form(disallow dragging) or not on-the-ply.  This is made possible by adding an ssSwitch inside the class.  You can set up the default whether form is pinned or not via lNoMove parameter and interactively thereafter it can be changed any time.  Here is how it looks like:


==============

I was not suppose to create a new ssClose class but MK Sharma, my first and among my most supportive subscribers, has requested a new ability for ssClose and ssClose2 classes which is to be able to be placed on the right side of the form instead of the left.  Said request/need has risen just because he is using a Menu and his users are accidentally closing his forms instead of clicking the Menu.

However, after receiving said request, I encounter a major problem, i.e., I forget where I saved (if ever I saved) the source PSD file I used for ssClose images.  Darn!  And I cannot simply flip those final images because the word close will be flipped as well.  Drat!

Anyway, also just because of that lapse on my side, I was forced to design a new button.  And since some may have found my ssClose designs appealing on their end, I decided to create this new class instead of replacing the old ones.  Here is the new class:



Aside from this being prettier (my taste) than its ancestor, I decided to add more features for this one.  Here are the new parameters:

LPARAMETERS nPosition, nBorderColor, nBackColor, lTransparent, cHotKey, nBorderWidth, lNoMove, lFixedBorder, nSpecialEffect

Thursday, August 9, 2012

2012 Southwest Fox - Looking Forward

October is fast approaching and every passing day I am starting to look forward into this year's SouthWest Fox DevCon.  Most especially after I looked into the available seminars.  Here are the list of Sessions:

    There are 7 conference tracks at Southwest Fox. "Level" shows the expected level for attendees for a session.

    Pre-Conference: These half-day sessions are offered on Thursday, October 18, and are available for an additional cost

    Extending VFP: The sessions in this track look at ways to extend VFP's reach, by using it together with other products or by taking advantage of native extension capabilities.

    Solidifying VFP Development: This track appeals to all VFP developers. Sessions cover either VFP fundamentals, aimed at those newer to VFP, whether moving up from FP2.x or coming to VFP from other languages; VFP best practices, aimed at helping all VFP developers improve; or in-depth looks at aspects of VFP that some developers may not have mastered yet.

    Taking Advantage of VFPX: The sessions in this track showcase the projects in VFPX, providing attendees with enough information to put those projects to work for them. These sessions are deep dives into specific VFPX projects.

    Technology for VFP Developers: This track looks at tools, technologies and techniques to make life as a developer easier and more productive.

    Moving VFP Applications Forward: This track covers topics related to taking VFP applications beyond the desktop, such as with web applications or mobile technology, as well as alternatives for new platforms and future application development.

    Post-Conference: These sessions are offered on the afternoon of Sunday, October 21; see the Workshops page for details. 

Please visit http://www.swfox.net/sessionsswfox.aspx for a more detailed info on courses available, speakers, and a lot more things.

To make things a lot easier, an online registration is now available here: http://geekgatherings.com/Registration


I would like to thank the late Ceil Silver, Doug Hennig, Tamar Granor and Rick Schummer; and the rest of the Committee involved in Ceil Silver Fund for giving some of us, developers who cannot easily attend on our own, the opportunity to  be part of the SouthWest Fox Devcon.   Plus to all of you who nominated me to be this year's ambassador. Believe me, the cost they have to shoulder plus the efforts they have to pour out in bringing a developer like me into the DevCon is huge.

I hope I will be seeing some of you whom I have known by names over the years  inside and outside of Foxite there. See you in October!

Jun Tangunan (sandstorm)

Friday, July 27, 2012

Start FireFox with Multiple Tabs

Whenever I open Firefox, I open 3 sites:

  1. Our ISP's Control Center to monitor our VSAT status
  2. Foxite
  3. My Blog's dashboard

So what I do before is:

  1. Open up Firefox and select from my Bookmarks the one for our ISP Control Center
  2. Then click a new tab and select Foxite again from my Bookmarks
  3. Finally click again a new tab and select my blog's dashboard link. 

The process is just okay but since I decided that I really needed to check those 3 whenever I open Firefox, I finally decided to make opening those 3 sites automatic for me.

So if you have a similar need like mine and want to do the same, then the easiest thing to do is instruct your browser to open those sites, each on its own tab, on Firefox's initial run.  How to do that?

Tuesday, July 24, 2012

Scroll Form Programmaticaly

A VFP form is tuned up properly to the wheel of the mouse so when you scroll up and down, the form when scrollbars are shown will follow.  However, there are some reports that sometimes the form stops scrolling when mouse is on top of other objects like a container for instance.  Test this:


loTest = Createobject("Sample")
loTest.Show(1)

Define Class Sample As Form
      ScrollBars = 2
      ScrollPos = 0
      Caption = 'Container prevents scrolling'

      Add Object Container1 As Container With ;
            top = 25,;
            left = 25,;
            height = 400,;
            width = 500
Enddefine


You can scroll all you want using the mouse scroll to no avail when it is on top of that container, and you may wonder  why.  That is because an object like a container has its own "MouseWheel" event that is capturing that mouse wheel scrolling when your mouse pointer is on top of it.

So since it is capturing said movement of the mouse wheel, the trick then is to force scroll the form from within that object's own MouseWheel event.  What if you have more containers then?  Plus some more objects?  Then that is where BindEvent() comes very handy.

However, one problem pose with the above.  Unlike grid, a form do not have a DoScroll event where we can simply instruct it to scroll.  So how can we then scroll it programmatically?


Friday, July 20, 2012

Drag, Drop and Retain It Part II - Grid Columns


Because of the sample about drag, drop and retaining positions I posted yesterday, a new request has been made inside the forum and this time it is about a grid rearranging columns on the ply and retaining that settings.

I am thorn between naming this Grid Tricks # 6 because it involves grid tricks but in the end I decided to make this part 2 of drag and drop samples.

Anyway, here is how to do that.  And with retaining settings, you should always have something to save those first and retrieve later so a table is my best bet.  This is just simple as well to serve as your guide.  Full blown need may mean you have to save as well the form name and the grid name.

Here is the sample codes should you be interested:

Thursday, July 19, 2012

Drag, Drop and Retain Positions

Here is another, moving objects around and retrieving positions on next form run.  This is just a simple demonstration of how we can do that:



While the dragging and dropping portion seems to be easy, plus preserving and retrieving those values later, what took me longer to figure out is how the rearranging of these objects will affect the tabindex properties of each object inside the container.  Anyway, this is maybe not perfect yet but at least you will have something you can start with and refine.

Copy-paste the codes to a .prg, run it, tick Allow Moving, then drag buttons around.  After that, close the form and then run it again.  See if it retains the last positions when you close the form and if the tabindex are proper.

Here is the code samples if you are interested:

Extracting Images from an Excel File

A new question has been raised inside Foxite which is how we can extract and save images from within an excel workbook so I thought, how indeed?

We can do manually by clicking an image (or a group of images) then choosing copy, opening paint and pasting it over there.  Man, that would be tiresome.

Or we can ensure the format to be of xlsx (2007 and 2010) then later renaming the extension from xlsx into zip, extracting that newly renamed zip file and digging into subfolder xl, then media to get all the jpeg and png images from within the worksheet file.   Read this if you are confused:  http://sandstorm36.blogspot.com.au/2012/02/why-appendimport-from-xlsx-fails.html

Another way which is much simpler because it does not require that manual renaming of xlsx to zip is this, saving the excel file into an HTML format and digging as well into the folder that holds images for the HTML.  And this is the way I decided to go for this example.  Here is the result:

Saturday, July 14, 2012

FoxRibbon - Interface Classes for VFP

For GUI lovers our there, here is another very interesting class from Guillermo Carrero, i.e., FoxRibbon

FoxRibbon is a class library VCX 100% Visual FoxPro which offers a number of tools to improve the visual appearance of our applications. Its use and distribution is free to all Visual FoxPro Community.


I have just downloaded the class and immediately I am very very impressed with it.  The class while packaged with 10 colors to choose from, is still highly customizable and comes with some more features like a very nice dropdown calendar, messagebox, progressbar, etc.



I have just run the sample and all I can say immediately at this point of initial tests is 'Wow!'.   I believe there are a lot more features I haven't seen yet.  You can get it from here: https://sites.google.com/site/foxribbonclass/


For those of you who don't know it yet, Guillermo Carrero is the co-developer of the also famous FoxBarcode  alongwith Luis Maria Guayan.



Thursday, July 12, 2012

Sality, an Ultimate Virus Strain

We were infected by this virus lately that has first manifested in our Payroll Department.  Sometimes, because the payroll staff are rushing, they fail to give us a flash drive coming from the banks for cross-checking and cleaning; before plugging it on theirs.

However, after the fortnight has been made where I started working on the infected units, I got a very big surprise because the attitude of this virus is no longer the one I am expecting and have experienced before. It seems to have grown sophisticated because I have done these things:

a.  Cleaning an infected unit by itself which in some cases of other malwares I am able to do, no dice

b.  Removing the harddrive and plugging those into another unit for safer and faster cleaning, immediately virus came back

c.  Completely repartitioning, reformatting and installing fresh everything....

And yet despite with an anti-virus installed on that freshly newly repartitioned, reformatted and reinstalled unit..... just within hours I realize that said unit is again infected via LAN, and said malware was even able to circumnavigate and disarm the antivirus that was installed which I have used in the first place to clean it as well.

Wednesday, July 11, 2012

Exporting VFP Tables to SQL Server 2005

Exporting VFP Tables to SQL Server 2005

VISUAL FOXPRO 9.0 - I find out that the easiest way (for me) to upload VFP free tables into a SQL Server 2005 database is through the Upsizing Wizard provided by Microsoft Access 2010.

When Microsoft still supports VFPODBC, we can do that by setting up a data source pointing to VFP  tables and import them to a  MS Access Database.

But according to MS, they no longer support the VFPODBC and they recommend the use of Visual Foxpro OLE DB driver instead.

Too bad;  but anyway, we can still do something about this. I'll demonstrate a similar technique that does the same. Without VFPODBC, we will rely on Access' built-in dBASE importing option. The downside though is that it will only let us import one VFP table to MS Access Database at a time.

 If you're in for some boring software stuff, please click here to read the rest of the article

Thursday, July 5, 2012

Grid Trick# 5 - Column Moved or Header Simply Clicked?

A question inside foxite is raised just now and it took my fancy on trying to find out how to differentiate if user simply clicks on the header of a column or has moved it.  Until I realize I was looking at the wrong things because really it comes only with two simple rules:

  1. If you wanted to do something when you click the header, then use header's click event
  2. If you wanted to do something when you reposition column, then use column's moved event
Here is a simple sample for that:

Zoom Outlook email message trick

I have learned a lot of things by reading and listening to others.  And there are some I learn by accident just like this one now.  Do you know we can zoom the outlook messages very easily?

I was just talking to my IT Support guy and at the same time trying to read an email, so I scrolled down using my mouse middle button but I suddenly realized I am zooming in and out instead of scrolling up or down.

The trick I later realized is because I am accidentally pressing Ctrl key while doing the scrolling using mouse middle button, because I wanted to do something before my mind was interrupted by my IT Support guy.  And as I was talking to him, I am playing with the mouse middle button as well, LOL!  Now I can read things clearer if I wanted to.

If you want to view it back to its accurate normal appearance, then just simply click on another message and click back onto that email message.

Enjoy!


Belatedly I realized that that feature also works as well with any Office products plus web browsers.

Monday, June 25, 2012

ssClasses Update



ssGridSorter Enhancement

I realized that it is annoying for the users of ssGridSorter that it kept on toggling back and forth from ASCENDING to DESCENDING every time they click a header.  So I decided to remove that auto-toggling.

The class will run from now on by default in ASCENDING order and users can click any header of the grid (excluding those with .controlsource of General, Memo and Blob) and they will all have that order (it won't auto-toggle anymore).  To toggle the order, users now need to right-click on any header.  So if the current order is ASCENDING, right-clicking on any header will turn the order into DESCENDING; and vice-versa.  Once it is on DESCENDING order, user can click (left-click of course) on any header of the grid's column and that current sort order will be followed.  To toggle, right-click again.

I also added the necessary tooltip text to guide the users.

ssExcel Pivot

a.  Changed the default font from Arial 10 to Calibri 8.
b.  Added the ability to change the font to be used. This._font = 'Calibri-10'
c.  Added row freezing

Tuesday, June 19, 2012

Facts about a country!



Well, I have constant visitors of my blog site but I believe most of you do not know one hidden feature here? Which is you can know some facts about your country or other countries as well. How is that then?


Monday, June 18, 2012

Grid Tricks#4- Clearer Search Results


Where is numbers 1, 2 & 3 Tricks?  We can simply treat #1 as the More Objects inside a Cell blog, #2 as the Various Images II blog and #3 as the Transparent Grid blog.

I decided to start showing some more tricks I do on my side using grids which I deem will be useful for others as well.  This is about making the search result clearer or more visible by highlighting the cell contents where a near match can be found.  If not, it is very tiring for the user's eyes to trace where exactly those near matches are.

Saturday, June 16, 2012

Block Breaker Tool

I have been converting image files into HexBinary values, manually breaking those into acceptable blocks and enclosing those with TEXT... ENDTEXT, then finally embedding the codes within ssClasses.  The purpose of that is so I can make my library self-sustaining for its images need. 

I wanted the codes to be embedded inside because I want better control of the class and of course to minimize the unnecessary maintenance which will not be possible should I save those binary values inside a table or a text file; and ship those along with _ssclasses library.  Those outside files will be prone to content alteration and with binary values, a single character changed will mean inability to convert the images back properly later.

Not to mention that when I ship the library, I only wanted to ship these two files:

_ssclasses.vcx
_ssclasses.vct

and nothing else.

Wednesday, June 6, 2012

Transparent Grids - Now & Then


I have been wondering whether I can make my grid transparent and indeed I found a way.  However, said transparency can only be attained when there is no RecordSource and yes it suits me just fine because who, in his right mind, would want a transparent grid with data?  That is not only painful to the eyes but is likewise annoying, LOL!


Here is a sample how we can achive that:

Monday, May 21, 2012

A small Listbox appearance trick!

Another question has been raised by a foxite member inside the forum about a listbox not looking totally disabled when Enabled=.F. is set.  While the items in the listbox becomes disabled, the background color remains to be white.  And really it do not look cool that the rest of the other objects in a form like a textbox, when disabled changes color, while a listbox still remains white.

I have not seen this because I almost don't use Listboxes in favor of Grids. However, for those of you who may be wondering how this attitude can be circumnavigated, the trick lies between two properties:

a.  DisabledBackColor
b.  ItemBackColor

Thursday, May 17, 2012

Why Pivot Report? Why not Crosstab?

A pivot report is among the underrated and underused powerful feature of Excel.  So I want to give some lights onto its importance because this is really helpful, not only to the end users, but also to the developers.

What is a Pivot Table?

In data processing, a pivot table is a data summarization tool found in data visualization programs such as spreadsheets or business intelligence software. Among other functions, pivot-table can automatically sort, count, total or give the average of the data stored in one table or spreadsheet. It displays the results in a second table (called a "pivot table") showing the summarized data. Pivot tables are also useful for quickly creating unweighted cross tabulations. The user sets up and changes the summary's structure by dragging and dropping fields graphically. This "rotation" or pivoting of the summary table gives the concept its name.

- wikipedia

Friday, May 11, 2012

More Objects inside a Grid Cell - Part II

May 7, 2014 Note:   If you are reading this, find an alternative way to achieve the same using DynamicFake method approach:  http://sandstorm36.blogspot.com/2014/05/more-objects-in-grid-cell-part-iii.html

=====

I thought I have explained things well on my first instructions of More Objects Inside a Cell blog because basically that is really it.  However, obviously I left some things which if readers looks closer to the Various Images in Grid Part II blog (BizCore Grid), they will see that the status of the vehicles change colors.  And I never deem it fit to expand the blog about More Objects because that blog is just a prelude of the Various Images I am planning to do next.  Plus I wanted readers to sort of experiment on their side how I was able to achieve that effect of status word changing colors based on conditions; if they like to achieve the same.  Like I said, all the basic ingredients are already on those two blogs.

But then, it appears that not everyone can see through the trick I used to achieve the same.  So based on a request of an ssClasses subscriber inside foxite forum, I decided to create one sample and post it here.  Now you will see how to achieve the same effect inside a cell of a grid with just a few tricks.

Thursday, March 29, 2012

Various Images in a Grid - Part II

I have previously posted a way to show different images in a grid on Weblogs using 5 image objects and employing DynamicCurrentControl property of the grid.  That is because the need is limited only to that 5 images. http://weblogs.foxite.com/sandstorm36/2008/08/09/placing-various-images-on-a-grid/

However, now that I need to really show varying undetermined number of images on a grid based on outside image files (jpegs) in a folder, that approach is a no no.  Therefore I sought other ways shown by experts such as Cetin Basoz and checked how that can be implemented on my needs. 

Most of the codes are adapted from Cetin's especially the usage of DynamicFontBold, except that this approach gets the images straight on outside files in a folder.  The trick is to be able to link the record with the real file name of the image file via one field (or several combined fields).  And since mine has an asset number and the images are named after the asset number (by design), then it did not pose any problem.  Here is the result:

Wednesday, March 28, 2012

More Objects Inside a Grid Cell

In pursuit of making the appearances of our app more powerful, I decided to make my grid more appealing by way of showing several objects inside a cell.  And that can be attained via containers plus manipulating .controlsource(s).

Let us say I have this SQL SELECT:

SELECT fld1, fld2, fld3, fld4, fld5, fld6, fld7, fld8, fld9, fld10 from mytable into cursor junk nofilter

So I have 10 fields above.  Normally we would have 10 columns as well to show everything inside a grid, a column for each field, a record for each row.  Now, I wanted to show only 2 columns where fields 1 to 5 will all be cramped inside Column1 and the rest on Column2.  Here is how to do it.

By default, a grid will bind itself to the current active table/cursor and will follow the field arrangement like in the above fld1, fld2.....etc.  Ignore the sequence of the fields because it will be useless now. 

Tuesday, March 20, 2012

Controlling the Panel from Within - Part II

Last time I created a blog called 'Controlling the Panel from Within' which I posted in Weblogs. http://weblogs.foxite.com/sandstorm36/2009/05/07/controlling-the-panels-from-within/

While I showed there how we can do that, it is limited to controlling just the main applet.  It do not show how we can dig down from within that applet.  This is actually supposed to be titled 'Drilling Down an Applet' but readers may say, what the heck is that?  So I instead named this as above.

On my first blog, I showed the way to gather all applets into a form and allows user to call those applets from that listbox using ShellExecute().  Here we will use RUNDLL32 instead.  While the same can only open the main applet again, we can employ scripting here to drill down further to objects inside that applet.

Monday, February 20, 2012

ssExcelPivot class


Summary of what this class can do:

  • Will create a pivot report inside excel or as html for you without needing much effort on your part.  You don't need to know automation nor pivoting to create wonderful reports
  • Gives you possible 84 report appearances on pivot report alone.
  • Gives you possible 84 report appearances on non-pivot report (looks differ than the pivot report output)
  • Allows user interaction or not
  • All you need is just a recordsource (cursor or table) with all the fields you need, declare values of some properties of the class (or not) and you are on the go.  No fuzz, no cuzz, straight mouth approach of report generation.
Properties that can be set to give the report its initial (default) look:


This one is a must:
  • _recordsource- specifies the record source which maybe a cursor or a table. 
 The rest are optional:

Why Append/Import From an .xlsx fails?


We do know that since Office 2003, VFP pose no problem importing from an .xls or any of its other formats; then came Office 2007 introducing with it an .xlsx format and suddenly VFP can no longer "directly" append nor import from it.  A lot has been baffled by this and maybe have thought 'hey, VFP is really dying!'.    So is it really VFP's incompetence or not?  Let us find out.

One solution I proposed to tackle that problem of importing/appending from an .xlsx file is via automation as I have shown in these blogs:

a. Appending/Importing from Excel 2007's xlsx via automation:
 http://weblogs.foxite.com/sandstorm36/archive/2009/11/20/9387.aspx

b.  Importing from an xlsx file via automation - Part II:
 http://sandstorm36.blogspot.com/2011/11/importing-from-xlsx-file-via-automation.html

The trick I used there is to save the excel file on a lower version format and I advice .xl5 format for that.

However, though I have shown the automation ways on those blogs, we haven't tackled exactly "why" appending/importing from an xlsx format is failing.  And this blog is meant to shed some light onto that.

With Office 2003 and lower versions, when we open an excel file, we are dealing with only a "single" file.  With the advent of Office 2007 however, along comes a new format called xlsx.  Why the extra x at the end?  Because that extra x at the end actually signifies the new format which is 'xml'.

With .xlsx, we are no longer dealing with a single file but "several" xml files.  An .xlsx actually is a compressed folder with several sub-folders and several xml files.  If you want to study it, here is what you should do:

a.  Create a copy of one of your xlsx files. 
b.  Rename the copy to any name you want but rename the extension as well from .xlsx to .zip
c.  Open or Extract
d.  Analyze the contents



Here is how it will look like:

VFP has no fault at all why it can no longer append nor import directly from an .xlsx file.  My automation approach works because what it does is like fusing all the pieces of a broken glass to make it as a whole again, which is what VFP is designed to recognize in the first place. 

So is VFP the one at fault on failure to append/import from an .xlsx file?  Now you know better!


Cheers!



Friday, February 10, 2012

ssPolyClock - a 100% VFP clock widget

Update: February 13, 2012

5 new skins for this class. Skins can be cycled via clicking on the arrows on the lower left of the clock.  Advantages of this class over activex ones are:
  • Works properly with Anchor.  Unlike activex where anchoring pose a little problem (if you don't know how to work around it), this one does not pose any problem with Anchor.
  • Can be skinned on the ply (6 skins to choose from)
  • Can be moved around your form (optional)
  • Can hide digital clock portion (optional)
Here are all skins for now:



That is all for now!

 ======

Originally, I gave you a tutorial under weblogs about adding a Graphical Analog Clock ( http://weblogs.foxite.com/sandstorm36/2008/05/27/graphical-analog-clock/ ) in your form.  That one utilizes a ShockWave Flash animation and is done using SwissMax.

The idea of that clock, as I have said there, plus the way to use it in our form comes from my cousin Glen Villar, my protegee and a proud member of Foxite forum.  Since ssClasses are becoming famous and I was not making any more clock widget, he volunteered to include his PolyClock class among my ssClasses objects and requested that I try to make it look better.  Well here it is now, Glen's PolyClock into ssClasses.

It is called ssPolyClock because the objects here are pure shapes with manipulated polypoints with the exception of the background image which is embedded now into the class.  And I salute my cousin Glen for thinking about this, the first ever (as far as I know) graphical analog clock that is 100% VFP in objects and codes.


Shown above is another widget called ssCalendar under old _Sandstorm36 class.  Do you like it?


P.S.  It appears that Glen is not the original who thought of something like this, LOL!  Let us give a proper credit to Luis Maria Guayan (co-creator of FoxBarCode) who published an Analog Clock running on Polypoints in 2005 (Wow!):  http://www.portalfox.com/article.php?sid=1887