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.