Foxite.COM Community Weblog

Foxite.COM Community Weblog - free weblog service for the Visual FoxPro Community.
Welcome to Foxite.COM Community Weblog Sign in | Join | Help
in
Home Blogs Forum Photos Forum Archives

Luis Guillermo Navas Dangel



  • Simple Workaround VFP 9 SP2 ToolTipText on Headers Bug

    Hi There. I really hate the ToolTipText header bug introduced in VFP9 SP2. I always wanted a fix or an easy workaround. I came with a simple solution that suits my needs, I hope it will work for someone else.

    I really love the Grid Enhancements Class of Craig Boyd and a lot of this class it's based in his code with a mix of Cesar Chalom's technic for tooltips in FoxCharts.

    In foxCharts, ToolTips are simple VFP label objects.

    One of the biggest requirements, was to be able to use the native ToolTipText property of the Headers (to prevent additional coding in already implemented systems). I also added simple sorting options to the class. If you enable the lAutoSort property, when the users clicks the header the grid will be sorted by that column, and if the users clicks again the sort direction will be inverted. For sorting to work, the Cursor should not be Table buffered. This could be modified, but I just wanted a quick solution to suits my needs and for now, this does it.



    To use it, simple drop an instance to a VFP form, and fill the property cSourceGrid with the name of your grid like Thisform.grdCategories, it has to be a name that can be evaluate it at runtime. The class will take the text stored in the ToolTipText property of the header object and display the tooltip when the mouse pointer moves to the header.



    This class will respect the value of ShowTips form property.

    Sample form included. To run the sample, just extract the contents of the attached ZIP file, set the Default Location to this folder and run Sample.scx

    I hope you enjoy it.

    Luis


  • PDFx Update Support for some SP2 Features

    This weekend, I finally had time to work on the class. Here are some updates:

    1. Support for Dynamics introduced with SP2
    2. Support for Objects rotation (only on labels and fields)
    3. Rounded rectangles are now supported, thanks to code of Dorin Vasilescu.
    4. Support for underline (not yet finished, and not sure if will be in final version, just for testing)
    I'm not using a subclass of the FFC classes.  The only requirement is the GDIPlusX library and haru dll, both included in the download.

    For a quick view, run the test form, and pick any of the reports included.
    Download the updated class, try it and let me know if you have any issues or suggestions.

    Enjoy.





    posted Monday, October 06, 2008 12:29 AM by luisn | 11 Comments
    Filed Under:
    Attachment(s): PDFxf.zip
  • Update PDFx Beta Free PDF Listener for VFP

    Update 2:  Please download the new updated version with the following modifications
    1. Name of the classes changed to PdfListener (normal pdf output) and pdfasimagelistener (pdf as Image file). Suuggested by Emerson Reed.
    2. Added property cCodePage to handle the different code pages. The list of possible values are here http://libharu.org/wiki/Documentation/Encodings#Singlebyte_Encodings

    I will try to update the class with more functions as soon as I can.

    Enjoy.

    Update: Please download the file again, there was an error in the Registry Class pointing to a header file, this was preventing the listener to draw text. Sorry for the inconvenience.

    Do you want to create PDF file from VFP in an easy way without installing printer drivers or any other complicate rutine?

    PDFx is a free open source report listener for creating PDF files from Visual FoxPro Reports.

    Two years ago, I developed a listener to create PDF files, at beginning because I thought about starting a business the listener was a shareware and you were able to download a Trial Version. The business was not bad, in fact just last week I had a few more sales of QUICKFRX2PDF. Anyway for that listener I was using isedQUICKPDF library which is not open source and I was not able to distribute the source code of it, so it was no practical to open source that pdf listener. A few months ago, while checking ReportSculptor I heard about the work of Dorin Vasilescu with HARUPDF, until that point I've never heard of that library before, so I check it on Google, and I found out it was open source, wrote it in C and with a good support and continue development; some of you may think I'm killing my business, but I decided it was time to give something back for free to the VFP community that has give so much.

    I started by browsing the documentation on the HARU site. Since I'm not a guru with API declarations, I checked the Visual Basic 6 Declarations Samples, and I had to recall in the samples of "Using Win32 functions in Visual FoxPro" specially to understand how to send Visual FoxPro data as C structures.

    Well the result is this class, which is fully open source and really easy to use and setup:

    To use it, just follow these simple steps:

    1. Include PDFx.VCX in your project.
    2. Include Dummy.Prg in your project and marked as excluded.
    3. Copy System.APP (GDIPLUSX library) to the project folder
    4. Copy libhpdf.dll to your Project folder.

    That is all you need to include in your project, and to call the library you can follow this example:

        Local loListener As ReportListener 
        loListener = NewObject('PdfListener1', 'PDFx.vcx') &&Use 'PdfListener2' to create PDF as an Image
        loListener.cTargetFileName = "MyFile.Pdf"
        loListener.QuietMode=.F.
        loListener.lEncryptDocument=.F.
        loListener.lCanEdit=.F. &&Only if lEncryptDocument=.T.
        loListener.lCanCopy=.T. &&Only if lEncryptDocument=.T.
        loListener.lCanAddNotes=.F. &&Only if lEncryptDocument=.T.
        loListener.lCanPrint=.T. &&Only if lEncryptDocument=.T.
        loListener.cMasterPassword="masterpassword" &&Only if lEncryptDocument=.T.
        loListener.cUserPassword="userpassoword" &&Only if lEncryptDocument=.T.
        loListener.lOpenViewer=.T.
        Report Form MyReport Object loListener

    And that's it.

    Please try it, and let me know any issues you may have.

    Current limitations:

    1. No support for Underline or strikeout style in text.
    2. Rounded rectangles will be transformed to ellipsis.
    3. Fills for shapes are not supported
    4. Objects Rotation.

    Future improvements:

    1. Objects rotation.
    2. Merge with existing PDF documents.
    3. Support Hyperlinks.
    4. Support annotations.
    5. Try to work around current limitations
    6. Create a Help file.
    7. Support all possible encoding.
    8. I'm not sure about the name, so suggestions are welcome.
    9. Please give me feedback!!! and report all the bugs it will have.

    Also please try it with different encoding, and let me know the problems you may have.

    I hope you find this a useful class and enjoy it.

    Luis Navas Dangel

    posted Tuesday, August 05, 2008 8:29 AM by luisn | 25 Comments
    Filed Under:
    Attachment(s): PdfxNew.zip
  • The day arrived

    Yes, it's not the end of the world, it's the beginning of a new experience for me. I have started to develop in C#. I was avoiding this move to be honest I didn't want to, but since there are almost no more jobs for a Visual FoxPro Developer, I had to start. I choose  C# over VB, because there are more Jobs, it's an international standard language now and the most important to me IT'S NOT VB. :)

    I know VB it's a new and powerful language, but it was VB, and that is enough for my personal point of view.

    I choose C# over Java, because I'm sadly used to Microsoft Tools, but I will keep my eye on Java, seems impressive for me.

    Also I choose C#, because I think Microsoft it's not going to kill it soon (I hope not...)

    As for my learning, well actually I started learning last week, by reading the great book of .Net for Visual FoxPro Developers, at the same time I downloaded all the Visual Studio 2008 express editions and installed on my PC, next I started to look for videos, since it's an easier way to learn, and I found some videos from Microsoft site, to be exact the site address is http://msdn2.microsoft.com/en-us/express/aa700758.aspx I downloaded all the videos, and started to watching them. To be honest, the first videos where really boring since we as VFP developers have a great amount of knowledge and after those beginners videos I already consider my self an intermediate Developer or at least not beginner.

    The next step I took, was to start transforming my simplest VFP applications to C#, but I tried to follow the good fundamentals I had from VFP. Until now, I must say, that I love the IDE, and I can't stop thinking "Why Microsoft never gave this support to VFP", seriously why???? with the same amount of support and advertising VFP would be really popular.

    Until now, everything it's ok, the transition hasn't been as hard as I thought it would be.

    Anyway I hope to become a good C# developer, and as always keep on working and developing in my beloved VFP for as long as I can.

    If anyone has done this before has a good free source of information to make this process easier, please put it in the comments.

  • VFP9 SP2 Available

        Hurry, hurry and download the SP2 for VFP!!!

    http://www.microsoft.com/downloads/details.aspx?familyid=a28ddec6-ba3c-49d0-8176-8c0b3fca06d1&displaylang=en

    Just wondering when will be all the DBI ActiveX available?


  • Visual FoxPro Can Create Office Plug In's

    We had a meeting some time ago in the company where I work, we were speaking in ways for a better use of the bandwidth of our connection. One of the points we talk about, was that every file sent as an attachment, should be a ZIP file. We all agree about this, but during the next week, we find out that not all of the employes were going to follow the rule (some because "they don't know how" even when you have teached them, some because they don't want to, etc). So I tought about a program that will take all the attachments from a message and create a ZIP file from them.

    A simple search in google, bring me a lot of choices for this, but at the same time, I was reading the newest entry on Craig Boyds blog (wich by the way it's always great), and came to my hands the latest version of his compression library, so yesterday I tried to create a COM server in VFP to create a ZIP file from all the attachments in an email message using Microsoft Outlook.

    This was a quick work, so I'm sure that anyone can make it better, I have only tried this with Outlook 2003, so please let me know any issues you may have.

    These are the steps, needed to make it work:


    1. First every office plug in based in COM, it's based in the following class IDTExtensibility2, what is this? well thanks to our Object browser, was really easy to find out it's the Microsoft Add In Designer, like this image shows




    So if you ever need to write one, this is the way to go. Drag and drop the interface part into a an empty PRG, and it will create the basic structure to the class we are going to build. After this part, we need to create another class that we are going to bind to the Microsoft Outlook application model, for this part I read all the information in the VFP Help File.

    Thi
    s is the code, of the two libraries:

    Define Class Connect As session OLEPUBLIC
        Implements IDTExtensibility2 In {AC0714F2-3D04-11D1-AE7D-00A0C90F26F4}#1.0
        oOutlook=Null
        oProxy=Null
       
    Procedure IDTExtensibility2_OnConnection(_Application As VARIANT, ConnectMode As VARIANT, AddInInst As VARIANT, custom As VARIANT) As VOID
            Local lcStr As String
            lcStr="Iniciando Servidor en: "+_Vfp.ServerName
            StrToFile(lcStr,"C:\LogNavas.Log")
            This.oOutlook=_Application
            This.oProxy=NewObject("OutlookEvents")
            If EventHandler(This.oOutlook,This.oProxy) Then
                lcStr=Chr(13)+Chr(10)+"BindEvent Hecho"
           
          StrToFile(lcStr,"C:\LogNavas.Log",1)
            Else
          
          lcStr=Chr(13)+Chr(10)+"No se pudo realizar el BindEvent"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
            EndIf
        EndProc
        Procedure IDTExtensibility2_OnDisconnection(RemoveMode As VARIANT, custom As
    VARIANT) As VOID
        EndProc
       
    Procedure IDTExtensibility2_OnAddInsUpdate(custom As VARIANT) As VOID
        EndProc
        Procedure IDTExtensibility2_OnStartupComplete(custom As VARIANT) As VOID
        EndProc
        Procedure IDTExtensibility2_OnBeginShutdown(custom As VARIANT) As VOID
            This.oOutlook=Null
            This.oProxy=Null
        EndProc
        Function Error(nError As Integer, cMethod As String, nLine As Integer)
         
    ComReturnError(cMethod+'  Error#='+Str(nError,5)+'  línea='+Str(nline,6)+' '+Message(),_VFP.ServerName)
       
    EndFunc
        Procedure Destroy
        EndProc
    EndDefine

    Define Class OutlookEvents As Session OLEPUBLIC
      
    Implements ApplicationEvents In Outlook.Application
        oFiles=Null
         cTempPath=""
       Procedure ApplicationEvents_ItemSend(ITEM AS VARIANT, CANCEL AS LOGICAL) AS VOID
            Local loItem As Object, lcFileName As String, lcPath As String, lnI As Integer, lnTotal
    As Integer, lcStr As String
            lcPath=JustPath(_Vfp.ServerName)+"\"
            Set Library To lcPath+"vfpcompression.fll"
            This.cTempPath=Addbs(Sys(2023))
            lnTotal=m.Item.Attachments.Count
            If lnTotal>0 Then
                This.oFiles=CreateObject("Collection")
                If File(This.cTempPath+"Adjuntos.Zip") Then
                    Delete File (This.cTempPath+"Adjuntos.Zip")
          
              lcStr=Chr(13)+Chr(10)+"Se elimino el archivo Adjuntos.ZIP"
               
         StrToFile(lcStr,"C:\LogNavas.Log",1)
                EndIf
                ZipOpen("Adjuntos.Zip",This.cTempPath,.F.)
                lcStr=Chr(13)+Chr(10)+"Se Creo el Archivo Adjuntos.ZIP"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
                For lnI=lnTotal To 1 Step -1
                    lcFileName=This.cTempPath+m.Item.Attachments(lnI).FileName
          
              m.Item.Attachments.Item(lnI).SaveAsFile(lcFileName)
                    ZipFile(lcFileName,.T.)
                   
    lcStr=Chr(13)+Chr(10)+"Se Agregó el Archivo "+lcFileName
                    StrToFile(lcStr,"C:\LogNavas.Log",1)
                    m.Item.Attachments.Item(lnI).Delete
                    This.oFiles.Add(lcFileName)
       
             EndFor
                ZipClose()
                m.Item.Attachments.Add(This.cTempPath+"Adjuntos.Zip")
                lcStr=Chr(13)+Chr(10)+"Se Adjunto el Archivo Adjuntos.ZIP"
                StrToFile(lcStr,"C:\LogNavas.Log",1)
                For lnI=1 To lnTotal
                    Delete File (This.oFiles.Item(lnI))
                    lcStr=Chr(13)+Chr(10)+"Se Eliminó el Archivo "+This.oFiles.Item(lnI)
                    StrToFile(lcStr,"C:\LogNavas.Log",1)
          
          EndFor
            EndIf
            This.oFiles=Null
      
    EndProc
       Procedure ApplicationEvents_NewMail() AS VOID
       EndProc
       Procedure ApplicationEvents_Reminder(ITEM AS VARIANT) AS VOID
       EndProc
       Procedure ApplicationEvents_OptionsPagesAdd(PAGES AS VARIANT) AS VOID
      
    EndProc
       Procedure ApplicationEvents_Startup() AS VOID
       EndProc
       Procedure ApplicationEvents_Quit() AS VOID
            If File(This.cTempPath+"Adjuntos.Zip") Then
                Delete File (This.cTempPath+"Adjuntos.Zip")
         
       EndIf
            Local lcStr As Strin
    g
            lcStr=Chr(13)+Chr(10)+"Se Finalizó la Sesión"
            StrToFile(lcStr,"C:\LogNavas.Log",1)
       EndProc
      
    Function Error(nError As Integer, cMethod As String, nLine As Integer)
          ComReturnError(cMethod+'  Error#='+Str(nError,5)+'  línea='+Str(nline,6)+' '+Message(),_VFP.ServerName)
       EndFunc
       Procedure Destroy
       EndProc

    EndDefine


    An important part of the code is the EventHandler(This.oOutlook,This.oProxy) function call, think of it like BindEvent() but for COM objects.

    The last step, is to create a key in the registry:

    [HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\AddIns\outlookzip.Connect]
    "LoadBehavior"=dword:00000003
    "Description"="To create ZIP files in all attachments"
    "FriendlyName"="Outlook ZIP"

    This is an image of the registry key:





    To check if everything is working as expected, in Outllook, go to Tools Menu, Options, Others tab, Advanced options, Com plug in and be sure that Outlook Zip is checked.

    Take a look at this image, if you have any doubt:




    You will find all the code in the file attached to this post.

    More information, and samples in another languages,  in:

    http://msdn2.microsoft.com/en-us/library/Aa140126(office.10).aspx
    http://www.outlookcode.com/article.aspx?ID=36




    posted Saturday, August 18, 2007 3:10 AM by luisn | 1 Comments
    Filed Under:
    Attachment(s): OutlookZip.zip
  • Visual FoxPro Popup Class

    Hi to all, when I saw Emerson Reed Outlook Class I love it at the first time, so I tried to create my small contribussion to this community that has give me a lot.

    That is how this class was born, I'm taking some ideas from the Emerson source, and other that came to my mind while I was working. The class it's free, and it's really easy to use:

    Take a look at this code:

    Public oPopup As Object
    Set Classlib To popup Additive
    oPopup=NewObject("popup","menus")
    With oPopup
        .AddPad("New","FileNew.Bmp","New File","Modify Command Temp")
        .AddPad("Open","FileOpen.Bmp","Open File","Getfile()")
        .AddPad("Save As...","FileSave.Bmp","Save File","PutFile()")
        .Addpad("\-") &&Separator
        .AddPad("First","NavigateFirst.bmp","Navigates to First Record","Messagebox('You Selected First Previous')")
        .AddPad("Previous","NavigatePrevious.bmp","Navigates to Previous Record","Messagebox('You Selected Navigate Previous')")
        .AddPad("Next","NavigateNext.bmp","Navigates to Next Record","Messagebox('You Selected Navigate Next')")
        .AddPad("Last","NavigateLast.bmp","Navigates to Last Record","Messagebox('You Selected Last Next')")
        .Addpad("\-") &&Separator
        .AddPad("Disabled Item and without Picture","","Selects all data in the Current Control","Messagebox('Disabled')",".F.")
        .AddPad("Last Popup Item","","Selects all data in the Current Control","Messagebox('Last Popup Item')")
        .Show()
    EndWith

    This will create a popup like this image:




    The class will detect in an automatic way the 3 standard themes of XP.

    Olive


    Silver


    The AddPad method will receive this parameters:
    lcCaption As String
    Caption of the Menupad
    lcPicture As String
    Picture to use in the Menupad
    lcMessage As String
    Message to display in Statusbar when selected or mouse over it.
    lcCommand As String
    Command to run when the user clicl on the pad
    lcSkipFor As String
    Expresion that must evaluate to boolean to enable or disable a menupad.

    Future Features that I wish to add:

    1. Enable to handle Sub Popups.
    2. Create a MenuBar
    3. Create a Builder
    4. Ability to define shortcuts and support for hotkeys
    5. Support to any Windows XP Theme.
    6. Create a toolbar base class to be partner of the menubar
    7. Fix all the bugs it may have.

    If anyone of you is interested in make it better, feel free to do it, I'm sure a lot of people will come with better ideas than this. Just let me know any update and please share it with all VFP developers.

    I hope you like

    Take care

    Luis Navas

    posted Monday, October 02, 2006 11:42 PM by luisn | 6 Comments
    Filed Under:
    Attachment(s): MenuTest.zip
  • QuickFRX2PDF Update

    Hi to all. It's been a while since I use my Blog here at this greate site www.foxite.com

    I have updated my Listener to create PDF Files, now it can merge existing documents into the PDF file being generated. I also had chance to get a better performance when processing reports with Images in it. Today I tried the INVOICE reports sample that come with VFP and it took me less than 50 seconds to proccess 747 pages. Here's some sample code of how to use it:

    You can generate two types of PDF files, a normal file, this PDF file will let you Copy the text, has a better resolution at greater zoom levels and the file size it's really small.

    Local loListener As ReportListener, lcTargetFile As String, lcMasterPassword As String, lcUserPAssword As String,;
    lcMergeFileName As String

    lcTargetFile="MyPDfFile"
    lcMasterPassword="master"
    lcUserPassword="user"
    lcMergeFileName="existingPDF"
    loListener = NewObject('PdfListener1', 'QuickFRX2PDF.vcx','QuickFRX2PDF.App')
    loListener.TargetFileName = lcTargetFile
    loListener.QuietMode=.F. &&Put .T. to turn off messagges
    loListener.EncryptDocument=.F. &&Put .T. to Encrypt Document
    If loListener.EncryptDocument
    loListener.MasterPassword=lcMasterPassword
    loListener.UserPassword=lcUserPassword
    EndIf
    loListener.MergeDocument=.F. &&Put .T. to Merge Document with an Existing PDF
    If loListener.MergeDocument
    loListener.MergeDocumentName=lcMergeFileName &&Name of the existing file to be merged with
    EndIf
    loListener.OpenViewer=.T. &&Put .F. to prevent Acrobat Reader from being opened
    Report Form myrerport.frx Object loListener

    And you can generate an Image PDF File, this kind of PDF will export everything as an image file to the document, people will not be abble to copy your text form it, but PDF files are bigger and has less resolution at greater zoom levels.

    Local loListener As ReportListener, lcTargetFile As String, lcMasterPassword As String, lcUserPAssword As String,;
    lcMergeFileName As String

    lcTargetFile="MyPDfFile"
    lcMasterPassword="master"
    lcUserPassword="user"
    lcMergeFileName="existingPDF"
    loListener = NewObject('PdfListener2', 'QuickFRX2PDF.vcx','QuickFRX2PDF.App') &&By calling PdfListener2 we create a PDF File as image.
    loListener.TargetFileName = lcTargetFile
    loListener.QuietMode=.F. &&Put .T. to turn off messagges
    loListener.EncryptDocument=.F. &&Put .T. to Encrypt Documente
    If loListener.EncryptDocument
    loListener.MasterPassword=lcMasterPassword
    loListener.UserPassword=lcUserPassword
    EndIf
    loListener.MergeDocument=.F. &&Put .T. to Merge Document with an Existing PDF
    If loListener.MergeDocument
    loListener.MergeDocumentName=lcMergeFileName &&Name of the existing file to be merged with
    EndIf
    loListener.OpenViewer=.T. &&Put .F. to prevent Acrobat Reader from being opened
    Report Form myrerport.frx Object loListener

    Also you can specify other options for both PDF Files types, you can enabled or disable print button, copy options and you can encrypt the document with 2 different levels and assign a passwords.
    Anyone interest in try it, can download a copy from www.crystalvfpclass.net
    It comes with complete Help file and sample form, and there's also a version in Spanish.
    Or send me an email to lnavasdangel@gmail.com

  • QuickFRX2PDF

    Update, I had to change my domain to www.crystalvfpclass.net I have published a new version of my PDF convertor. I'm really excited with this realese. It's now faster than before, has a Help File and the PDF Files are much smaller. In the previous version the class exported all pages as images to the PDF, this new version exprts everything as it should, text as text and so on. Please take a look at it here: http://www.crystalvfpclass.net/QuickFRX2PDF.htm The spanish version can be find it here (Versión en español): http://www.crystalvfpclass.net/QuickFRX2PDFEsp.htm The money I get from the sales of this library will be used to make cirgury to my kid, he is deaf and he needs a cochlear implant. Thanks a lot for your time and let me know any bugs you find.
  • My first post here, bringing you a new Listener Class

    I have updated the link to the file, thanks to Borislav Borisovv for the space in his server. Please try to download the file again. Well it's my first time playing with Blogs, first of all I will like to thank Eric for this oportunity. To anyone interested I have created a new listener class for creating PDF files from VFP reports. It's the first version, and it will be improved in the future. Please let me know any problem you have or bug found in the class. You can find more information here: http://www.crystalvfpclass.com/QuickPdfVfp.htm

This Blog

Post Calendar

<March 2010>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Post Categories

Syndication