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.