2011-11-29

FoxyPreviewer for non Latin Languages (v2.87)

Folks,

This is specially for people who work FoxyPreviewer and with a different codepage from 1252 (Latin).
Just uploaded a new version, v2.87 with a fix for some fonts that were appearing strange, condensed, just like below.
Thanks to Ivo Indra and Max Arlikh (tests and screenshots) for their tests, now I know that this solved for Russian and Czech languages. Hopefully this fix will be applicable to other languages.

So, if you're from a non latin country, please update to the latest version, at least 2.87, and let me know how that goes.

The wrong output appears first, then the fixed and correct:




Foxypreviewer general info
Foxypreviewer documentation
FoxyPreviewer FAQS
Foxypreviewer downloads

2011-04-19

The simplest way to create your PDF's / FoxyPreviewer Latest changes

It's been a long time since my last blog post about foxypreviewer. although somehow quiet in the blog, the work behind the scenes has been hard, and I've just released version 2.38, with several fixes and enhancements.

One of the coolest is the following:
to export a report to PDF without previewing, people just need to do the following:
     DO FoxyPreviewer.app
     REPORT FORM YourReport OBJECT TYPE 10


Yes !
That's all you need.
Even better than that, the new - oops !!!!, hahahaha, VFP9 is quite old right now, reporting system from VFP9 allows me to access some of the report clauses used in the report form command. so now we can use the object type clause of the report form command much better, using the "to file" and the "preview", see:

     DO FoxyPreviewer.app
     REPORT FORM (_Samples + "\Solution\Reports\Wrapping.frx") ;       
          OBJECT TYPE 10 ; && regular PDF
          TO FILE ("c:\FoxyNewTest.PDF") ; && destination file        
          PREVIEW    && open the default PDF viewer


to file - is the destination file, that can be sent directly in the report form command !
preview - opens the default file viewer, eg. adobe reader for PDFs

So, in summary, I've enabled 2 object type's allowing automatic PDF generation, without previewing, with just one single line of code, just the same way we used to run our reports!
  • object type # 10 = regular PDF, searchable
  • object type # 11 = PDF as image, non searchable
  • object type # 12 = RTF
  • object type # 13 = XLS
  • object type # 14 = HTML using XSL
  • object type # 15 = HTML using basic HTML commands, easier to export to web
  • object type # 20 = Any file type from the above, just send the corrret file extension, and FoxyPreviewer will internally use the needed ReportListener to create the output
New horizons
A very cool part of all this is that now we have even a new option for report previsualization, trasforming our reports in pdf, and using Adobe Reader to preview them !
that's really neat! Because the reader brings some very nice options for printing, text searching, hyperlinks, emailing, saving, etc etc etc...
If you want to customize your PDFs using the new object type clause, of course you can! Just use the following properties available in the _Screen.oFoxyPreviewer object:
WITH_Screen.oFoxyPreviewer
    .lQuietMode
    .lPdfEmbedFonts
    .lPdfCanPrint
    .lPdfCanEdit
    .lPdfCanCopy
    .lPdfCanAddNotes
    .lPdfEncryptDocument
    .cPdfMasterPassword
    .cPdfUserPassword
    .lPdfShowErrors
    .cPdfSymbolFontsList
    .cPdfAuthor
    .cPdfTitle
    .cPdfSubject
    .cPdfKeywords
    .cPdfCreator
    .cPdfDefaultFont
    .lOpenViewer
    .nPpdfPageMode


These properties are all described in the foxypreviewer documentation.
Of course this needs some tests, i'm waiting for the feedback of people interested in that feature.

The recommended mode - make it simple !!!

From now on, I'm recommending people to use only the simplified mode:
     DO FoxyPreviewer.app
     REPORT FORM YourReport PREVIEW

Some of the main improvements / fixes

- improved the fonts substitution in the PDF rendering. the fonts Arial and Courier New will appear well, using some internal fonts from the pdf engine.
- wingdings was enabled too!
- fix in PDF "stretch to fit" and multilines sentences - thanks to Fabio Vieira
- fix sending emails, automatic opening tables
- from now on, whatever that the pdf engine will not be able to draw, it will get an image from the source report surface, crop and paste the image in the PDF document. This works nice for barcodes, and some fonts that can't be embedded.
- included all of the available properties for the complete mode to the "_screen.ofoxypreviewer" object (that is created after you "do foxypreviewer.app"
- several small fixes in the xls rendering, hopefully now all reports will generate valid worksheets. (special thanks to jorge chang for his samples and testing)
- using the simplified mode now you can change your printer directly from the combobox, thanks to lisa slater nicholls, for her great article "a print job to call your own"


Special thanks

- to all the translators who have been translating the localizations table, alowing the tool to be multilanguage. currently we have 16 languages available!
- Soykan Ozcelik and Luis Maria Guayan, for their terrific support, tests and help, and more than that, for translating the Foxypreviewer documentation to Turkish and Spanish, allowing more people to use the tool, and for providing a very positive and constant support in their local VFP forums. currently we have all dialogs, tooltips and captions available in:

  • english
  • portuguese
  • czech
  • spanish
  • dutch
  • turkish
  • french
  • german
  • indonesian
  • arabic
  • greek
  • italian
  • persian
  • polish
  • russian
  • swahili
- and thanks to all people who have been testing this product very deeply.

That's super important, because this utility is getting really big, with lots of possibilities of usage, and for me it's impossible to test in all environments.


Documentation

As said above, the documentation has been updated, and also translated to turkish and spanish:
English documentation
Turkish documentation / Türkçe dökümantasyon
Spanish documentation / Documentacion en español


The foxypreviewer.app file size

- notice that the file foxypreviewer.app has become bigger, about 3MB. that is because I added the "debug info" information to the app.

That makes the file bigger, but on the other hand, provides a more detailed debugging information. that way, people will be able to tell me the line that originated the bug, even running foxypreviewer in production.

That will be only for now, during the tests. in the future, after i stop making constant changes, I'll remove that, and the apps will come back to the original and compact size, about 1.5 MB

And of course, you can recompile the app using the sources, removing the debuginfo if you want!

Foxypreviewer general info
Foxypreviewer documentation
FoxyPreviewer FAQS
Foxypreviewer downloads

2011-03-14

FoxCharts new release - with Double Y Axis

Just uploaded a new release of FoxCharts, a VFP-X project 

This version brings the so asked "double Y axis" charts as the main change.
  • Multicharts with negative values that were not being drawn correctly in some situations;
  • Line charts are drawn much faster (5x faster) when drawing with line caps (with shapes in the chart intersections);
  • Other small tweaks
        https://github.com/VFPX/FoxCharts/tree/master/FoxCharts_1.37b

        Have a look at the sample "chartssample_builder_2y.scx" in the samples folder of FoxCharts
        Just some few but important comments:
        1. needs to use depth = 0 (max 2)
        2. preferrably 2 data lines, one using the left axis and the other for the 2nd
        3. set the legends to the top

        Pay attention to the new properties:
        • ChartType = 18          && the newest chart type
        • Fields(n).AxisIndex = 2 && to what axis the data will correspond (1 = default)
        • LegendPosition = 6      && top center

        Having this, now you are able to create a chart like this, with no effort:



        Here is a simple script showing how to achieve the chart below directly:



        create cursor sales( ; 
            chart1 i null, ;
            chart2 i null, ;
            legend c (30) NULL)
        
        insert into sales values (130,      0, "jan")
        insert into sales values (120,  25000, "feb")
        insert into sales values ( 45,  50000, "mar")
        insert into sales values ( 60,  75000, "apr")
        insert into sales values ( 75, 100000, "may")
        insert into sales values (110, 135000, "jun")
        
        set classlib to locfile("foxcharts.vcx")
        
        public oform as form
        oform = createobject("form")
        oform.newobject("ochart","foxcharts","foxcharts.vcx")
        
        local loChart as Foxcharts of "foxcharts.vcx"
        loChart = oForm.oChart
        
        with loChart
             .Backcolor = rgb(255,255,255)
             .BrushType = 2
             .ChartsCount = 2
             .ChartType = 18
             .ColorType = 1
             .Depth = 0
             .FieldAxis2 = 'legend'
             .FieldLegend = 'legend'
             .FontName = 'verdana'
             .Height = 288
             .LegendPosition = 6
             .SourceAlias = 'sales'
             .Width = 732
        
             with .subtitle
                  .caption = 'chart subtitle'
             endwith
        
             with .title
                  .caption = 'testing 2nd y axis'
                  .forecolor = rgb(0,128,255)
             endwith
        
             with .fields(1)
                  .axisindex = 1
                  .color = rgb(255,0,191)
                  .fieldvalue = 'chart1'
                  .legend = 'gr1'
                  .shape = 5
             endwith
             with .fields(2)
                  .axisindex = 2
                  .color = rgb(0,142,146)
                  .fieldvalue = 'chart2'
                  .legend = 'gr2'
                  .shape = 2   && 'vfpxicon.png'
             endwith
             loChart.DrawChart()     loChart.Visible = .t.
        endwith
        
        oForm.Width  = loChart.Width
        oForm.Height = loChart.Height
        oForm.Show()

        2011-01-21

        Using the CTL32 ProgressBar from FoxyPreviewer

        Foxypreviewer.app is a collection of classes. Inside the APP there are several classes, that you can access directly using VFP.
        Recently I received a request to show how the ctl32 progressbar could be used directly.

        Thats's really simple ! The key command is NEWOBJECT(), that allows us to access classes from an external EXE or APP.
        First of all the author of this gem, the CTL32 progressbar is Carlos Alloatti. For the complete information on how to use it, please go directly to the CTL32 website: www.ctl32.com.ar

        Usage:


        =DOTHERM(90, "Caption", "TitleBar") && shows the regular progressbar with 90%


        =DOTHERM(-1, "Caption", "TitleBar") && the -1 value in the 1st parameter brings the marquee cool effect


        =DOTHERM() && turns off the progressbar







        * doTherm.prg
        * =doTherm(90, "texto Label", "titulo")
        * =doTherm(-1, "teste2", "titulo") && continuo
        * =doTherm() && desliga
        
        lparameters tnpercent, tcLabeltext, tctitletext
        
        if not pemstatus(_screen, "oThermForm", 5)
           _screen.addproperty("oThermForm", "")
        endif
        
        IF EMPTY(tnPercent)
           TRY
              _SCREEN.oThermForm.RELEASE()
              CATCH
           ENDTRY
           _SCREEN.oThermForm = NULL
           RETURN
        ENDIF
        
        
        IF TYPE("_Screen.oThermForm.Therm") <> "o"   
           DO CreateTherm
        ENDIF
        
        LOCAL loThermForm AS Form
        loThermForm = _SCREEN.oThermForm
        IF NOT EMPTY(tcLabelText)
           loThermForm.ThermLabel.CAPTION = tcLabelText
        ENDIF 
        
        IF NOT EMPTY(tcTitleText)
           loThermForm.CAPTION = tcTitleText
        ENDIF 
         
        IF tnPercent = -1
           loThermForm.Therm.Marquee = .T.
        ELSE
           IF loThermForm.Therm.Marquee = .T.
              loThermForm.Therm.Marquee = .F.
           ENDIF
           loThermForm.Therm.VALUE = tnPercent
        ENDIF 
        loThermForm.VISIBLE = .T.
        RETURN
        
        
        PROCEDURE CreateTherm
        LOCAL loForm AS Form
        loForm = CREATEOBJECT("Form")
        _SCREEN.oThermForm = loForm
        LOCAL lnBorder, liThermHeight, liThermWidth, liThermtop, liThermLeft
        lnBorder = 7
        WITH loForm AS FORM
           .SCALEMODE = 3 && pixels
           .Height = 48
           .HALFHEIGHTCAPTION = .T.
           .WIDTH = 300
           .AUTOCENTER = .T.
           .BORDERSTYLE = 3 && Fixed dialog
           .ControlBox = .F.
           .CLOSABLE = .F.
           .MAXBUTTON = .F.
           .MINBUTTON = .F.
           .MOVABLE = .F.
           .ALWAYSONTOP = .T.
           .ALLOWOUTPUT = .F.
        
           .NEWOBJECT("Therm","ctl32_ProgressBar", "pr_ctl32_ProgressBar.vcx", LOCFILE("FoxyFreviewer.app"))
           .NEWOBJECT("ThermLabel", "Label")
        
           .ThermLabel.VISIBLE = .T.
           .ThermLabel.FONTBOLD = .T.
           .ThermLabel.TOP = 4
           .ThermLabel.WIDTH = .WIDTH - (lnBorder * 2)
           .ThermLabel.ALIGNMENT = 2 && center
           liThermHeight = .Height - (lnBorder * 2) - .ThermLabel.Height
           liThermWidth = .Width - (lnBorder * 2)
           .VISIBLE = .T.
        ENDWITH
        liThermTop = lnBorder + 20
        liThermLeft = lnBorder
        
        WITH loForm.Therm
           .TOP = liThermTop
           .LEFT = liThermLeft
           .HEIGHT = liThermHeight
           .WIDTH = liThermWidth
           .MarqueeSpeed = 30
           .MarqueeAnimationSpeed = 30
           .VISIBLE = .T.
           .CAPTION = ""
        ENDWITH
        ENDPROC
        




        2010-11-22

        FoxyPreviewer v2.00 - New email form

        The FoxyPreviewer email form uses a custom HTML editor created by Frederic Steczicky from atoutfox.org, and allows you to:

        • generate html outputs for the body of your message
        • changing the formatting, alignments, fonts, adding pictures, hyperlinks, etc...
        • preloading an html
        • attaching more files is allowed
        • mark message as priority
        • ask for read receipt




        another cool thing is that after you click on "send", a continuous progress bar, with the cool marquee effect (thanks to Carlos Alloatti) will appear, till the message is delivered:



        the old email form, that could generate only plain text messages is still there, you may select it in the settings form:



        Obviously, some new messages need to be translated. if you want it to be enabled for your native language, download the most recent version of foxypreviewer, and send me your version of the file foxypreviewer_locs.dbf



        Foxypreviewer general info
        Foxypreviewer documentation
        FoxyPreviewer FAQS
        Foxypreviewer downloads

        2010-11-11

        FOXBARCODE !!!

        Thanks to Luis Maria Guayan and Guillermo Carrero from the spanish speaking community, now we have a brand new freeware and open source project for VFP.

        Foxbarcode is a 100% Visual Foxpro class that provides a tool for generating images with different bar code symbologies to be used in vfp forms and reports, or exported to other applications.



        You can learn more about the class foxbarcode and download freely from https://github.com/VFPX/FoxBarcode
        The most important barcodes are already available, and they're already working on new ones.

        Instead of using some truetype fonts to generate the barcodes, they are using gdi+, with the gpimage2 class (an old super light weight wrapper class for gdi+, originally created by alexander golovlev and enhanced by me). using gpimage2, they managed to provide backwards compatibility for even vfp6 users !

        Please check this out!
        The project is outstanding, and even the sample form is brilliant! very good looking and functional.
        the samples provided bring solutions to some real situations. even a bar code builder is available.


        picture 1: demo form


        picture 2: report sample: employees cards


        picture 3: barcode types

        now see how simple it is for you to generate your own barcodes:

        1. run the samples form

        2. play with it, changing the controls available information

        3. click at the "builder script" button

        4. copy and paste the generated code



        picture 4: barcode builder


        Here's an english translation, from luis maria's blog
        http://weblogs.foxite.com/luismaria/archive/2010/11/06/13426.aspx

        Thanks a lot Luis Maria and Guillermo!

        2010-11-03

        SWFOX - "The amazing VFP2C32 library" - session by Eric Selje

        eric selje summarizes very well what is vfp2c32 in his white paper:


        vfp2c32 is an fll that encapsulates windows api functionality into functions that are easily called from vfp.
        the advantages to this fll are



        • you don’t have to explicitly declare each dll you want to use
        • the fll takes care of converting the parameters into a struct that the api understands, which relieves you of a huge burden
        • it gracefully handles errors that the api returns
        • all c++ source code is included

        christian ehlscheidt from germany did a fabulous job in this library. the quantity of functions wrapped from the confusing win32 api is very big, and i've been using this library since 2006 for some specific tasks, but i confess that i always felt that i was not using even 1% of all it could provide to me. apart from that, indirectly i've been using it as a part of the ctl32 library from carlos alloatti.



        unfortunately the documentation was very poor. the download came with some nice samples, but that was all. so, for me, eric's session in swfox represented a great oportunity to get in touch with some more features, functions from this library. i had already read the whitepaper on the plane, and it was a very nice teaser for me :-)


        i was really glad to see that this has changed. christian documented a great part of the functions, and eric selje provided an additional documentation, with detailed samples as the white paper for his great session. it was very nice to see it being shown to people, because this library is considered a real gem.


        another cool thing shown by eric that i didn't know is that christian delivers a prg that installs intellisense for these functions, a terrific help. cool to know that some functions from the libcurl wrapper from carlos alloatti are there only because of some callback functions from vfp2c32.


        after this session, i got really encouraged to get back to this library, and enhance my benefits from it. if you already use the ctl32 classes, you don't even have to install it, because it's already there !