Welcome to Foxite.COM Community Weblog Sign in | Join | Help



New ThemedControls version (3.5.0)

Today I've posted a new ThemedControls version (3.5.0) at VFPX site.

You can download it here.

 

Recent changes:

  • Minor bug fixes;
  • ThemedControls take care itself when to create a ThemesManager object;
  • Help is available at VCX folder (ThemedControlsHelp.htm).
  • ThemesManager
    - ThemeNumber 0 (Automatic) was removed and a new InheritWindowsTheme property was created;
    - Added a method named ShowPanel to display a form where you can change the active theme;
    - Hardcoded themes was changed to a XML file (may be customized in the future);
    - Performance improved.
  • Button (New control - Not finished yet!)
    - Compatible with Outlook themes (just like OutlookNavBar);
    - Keyboard navigation enabled.
  • ExplorerBar (New control)
    - Panel groups like the ones in Windows XP;
    - Compatible with Outlook themes (just like OutlookNavBar);
    - Keyboard navigation enabled.
  • OutlookNavBar
    - Support for HotKeys in button caption;
    - Options to change the theme from shortcut menu are back;
    - Added icons to Show More and Show Less shortcut menu options;
    - Implemented a lot of suggestions;
    - Now it works as expected in toolbars;
    - Compatible with Outlook themes.
  • ToolBox
    - Implemented a lot of suggestions;
    - Similar to the new VFP ToolBox;
    - Compatible with Outlook themes (just like OutlookNavBar);
    - Keyboard navigation enabled.
  • ZoomNavBar
    - Added the capability to disable/enable buttons and stack buttons;
    - Implemented a lot of suggestions;
    - Compatible with Outlook themes (just like OutlookNavBar);
    - Now it works as expected in toolbars;
    - Added a bar and reflection effect;
    - Added balloons to show button's description;
    - Added the capability to display a menu when button is clicked.

If you have any questions, suggestions or want to report bugs, please contact me.

Some features in this new version could not be implemented without the help and cool ideas from this folks: Bernard Bout, César Chalom, Carlos Alloatti, Rick Schummer, Doug Hennig, Craig Boyd and Mauricio Marques.

Thank you guys!

Here are some screenshots...

 

 

 

posted by emersonreed | 20 Comments
Filed Under:

A simple guide on how to use ThemedControls - Part 1

Add the following files to your project:

  • Text files from Other tab in Project Manager
    Ctl32.h (mark it as "Excluded" from your project)
    ThemedControls.h (mark it as "Excluded" from your project)
    Themes.xml (mark it as "Excluded" from your project)
    *** Don't forget to distribute these xml file together with your application! ***
  • Applications from Code tab in Project Manager
    System.app (GDIPlusX from VFPX)
    *** Don't forget to distribute these app file together with your application! ***
  • Programs from Code tab in Project Manager
    Ctl32.prg
    Ctl32_Api.prg
    Ctl32_Classes.prg
    Ctl32_Functions.prg
    Ctl32_Structures.prg
    Ctl32_Vfp2c32.prg
  • Classes tab in Project Manager
    Buttons.vcx
    Ctl32.vcx
    ExplorerBar.vcx
    OutlookNavBar.vcx
    ThemedControls.vcx
    ThemedControlsBuilders.vcx (mark it as "Excluded" from your project)
    ToolBox.vcx
    VFPX.vcx
    ZoomNavBar.vcx
    *** Don't use controls from Buttons.vcx, ExplorerBar.vcx, OutlookNavBar.vcx, ToolBox.vcx and ZoomNavBar.vcx directly because they are base classes. Use the subclassed controls in ThemedControls.vcx. ***

 

Before use any ThemedControl:

The ThemesManager object used to handle themes is created automatically, but you need to destroy it before finish your application.

* Destroy ThemesManager object
If Vartype(_Screen.ThemesManager)=="O"
   _Screen.RemoveObject("ThemesManager")
Endif

* Destroy BindWindowsEventsProxy object
If Type("_vfp.BindWindowsEventsProxy")<>"U"
   _vfp.BindWindowsEventsProxy = Null
Endif

 

To use Button:

  1. Add a ThemedButton object from ThemedControls.vcx to your form;
  2. Double click CustomBuilder property in Properties Window to show the Builder;
  3. Fill the properties and click in Save and Exit button;
  4. Use Click method to handle the button click.

 

To use ExplorerBar:

  1. Add a ThemedExplorerGroup object from ThemedControls.vcx to your form;
  2. Double click CustomBuilder property in Properties Window to show the Builder;
  3. Fill the properties and click in Save and Exit button;
  4. Click with right mouse button in ThemedExplorerGroup and choose Edit from shortcut menu to edit the control;
  5. Click with right mouse button in cntUserControls and choose Edit from shortcut menu to edit the control;
  6. Place any control that you want inside cntUserControls;
  7. Repeat steps from 1 to 6 to create how much groups you want;
  8. Add a ThemedExplorerBar object from ThemedControls.vcx to your form;
  9. Select all ThemedExplorerGroups you created and press CTRL + X in your keyboard;
  10. Click with right mouse button in ThemedExplorerBar and choose Edit from shortcut menu to edit the control;
  11. Press CTRL + V in your keyboard to move all ThemedExplorerGroups inside ThemedExplorerBar.

Or

  1. Add a ThemedExplorerBar object from ThemedControls.vcx to your form;
  2. Double click CustomBuilder property in Properties Window to show the Builder;
  3. Fill the properties and click in Add this group to the bar button;
  4. Repeat step 3 to create how much groups you want;
  5. Click with right mouse button in ThemedExplorerBar and choose Edit from shortcut menu to edit the control;
  6. Click with right mouse button in ThemedExplorerGroup and choose Edit from shortcut menu to edit the control;
  7. Click with right mouse button in cntUserControls and choose Edit from shortcut menu to edit the control;
  8. Place any control that you want inside cntUserControls;
  9. Repeat steps from 6 to 8 for each group you created.

 

To use OutlookNavBar:

  1. Add a ThemedOutlookNavBar object from ThemedControls.vcx to your form;
  2. Click with right mouse button in ThemedOutlookNavbar and choose Edit from shortcut menu to edit the control;
  3. Click in the empty control area to select the Panes pagreframe object;
  4. Set the PageCount property to the number of buttons that you want to display;
  5. In the Properties Window, activate each page and set Caption, HotKey, Picture16 and Picture24 properties;
  6. Add the controls you want to display in each page (you can add any control: TreeView, TextBox, CommandButton, ...);
  7. Use ButtonClicked method to handle the correspondent button click. This method receive 3 parameters about the button clicked: lnNumber, lcCaption and lcPicture24.

*** Note that at run time, the control will create a button for each page and will use Caption, HotKey, Picture16 and Picture24 page properties as the source of caption and picture button properties. ***

 

To use ToolBox:

  1. Add a ThemedToolBox object from ThemedControls.vcx to your form;
  2. Click with right mouse button in ThemedToolBox and choose Edit from shortcut menu to edit the control;
  3. Click in the empty control area to select the Panes pagreframe object;
  4. Set the PageCount property to the number of titles that you want to display;
  5. In the Properties Window, activate each page and set Caption property;
  6. Add the controls you want to display in each page (you can add any control: TreeView, TextBox, CommandButton, ...);
  7. Use TitleClicked method to handle the correspondent title click. This method receive a parameter named lcTitle containing the name of title clicked.

*** Note that at run time, the control will create a title for each page and will use Caption page property as the source of caption title property. ***

 

To use ZoomNavBar:

  1. Add a ThemedZoomNavBar object from ThemedControls.vcx to your form;
  2. In the Init method, place the code to add the buttons that you want to display:

    DoDefault()
    With This
       .AddButton("Printers","Manage your printers.","Printer96.png")
       .AddButton("Display","Change the display settings.","Monitor96.png")
       .AddButton("Explorer","Show computer's files and folders.","Folder96.png")
       *
       .AddButton("Separator")
       *
       .AddButton("ControlPanel","Change your OS settings.","ControlPanel96.png")
       .AddStackButton("ControlPanel","Button1","Add/Remove programs","Software32.png")
       .AddStackButton("ControlPanel","Button2","Hardware settings","Hardware32.png")
       .AddStackButton("ControlPanel","Button3","Network settings","Network32.png")
    Endwith
  3. Use AddButton method to add a button and AddStackButton to add an option to a button menu.
    Sintax:
    AddButton( cButtonName, cToolTip, cImagePathAndName )
    AddStackButton( cParentButtonName, cButtonName, cToolTip, cImagePathAndName )
  4. Use ButtonClicked and StackButtonClicked to handle the correspondent button click:
    Lparameters lcName
    Do Case
       Case lcName=="Printers"
          apiShellExecute(0, "Open", "Control.exe", "Printers", "", 1)
       Case lcName=="Display"
          apiShellExecute(0, "Open", "Control.exe", "Desk.cpl", "", 1)
       Case lcName=="Explorer"
          apiShellExecute(0, "Explore", "", "", "", 1)
       Otherwise
          Messagebox("Button '"+lcName+"' was clicked!")
    Endcase

There's a lot more to know about ThemedControls.

ASAP I'll post more information on how to use them.

If you have questions, suggestions or want to report bugs, feel free to contact me.

posted by emersonreed | 4 Comments
Filed Under:

ZoomNavBar new feature

I've added a new feature to disable/enable buttons and stack buttons in ZoomNavBar.

Now you can disable/enable a button passing a parameter in AddButton and AddStackButton methods (when button is created) or calling the new SetButtonState and SetStackButtonState methods.

ZoomNavBar is part of ThemedControls that you can download here.

Here is a screenshot of the new feature:

posted by emersonreed | 1 Comments
Filed Under:

A new control is on the way... [Updated]

Here are some screenshots from ThemedExplorerBar, the new ThemedControls member.

Currently the control is working like a charm but I'm trying to make it more easy to configure.

 

It will be available soon. Stay tuned!

VFP rocks!

posted by emersonreed | 6 Comments
Filed Under:

C5 error in a grid with user defined column and header members

Some days ago, while developing a new application, I get a C5 error in VFP 9 SP 2 that crashes my application.

Making some tests I found that the error occurs when I use a command in a menu item to run a form with a grid with user defined column and header members.

The only way to avoid this error was change the command in the menu item to a procedure to call the form.

Note that the same application run without any error in VFP 9 SP 2 prior versions.

I've made a sample application and posted at Foxite and UT forums with the steps to reproduce the error.

After receive confirmations from Carlos Alloatti and Sergey Berezniker (thanks for both) that this was a bug, I reported it at MS Connect site as you can see here:

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=311857

This bug was also reported at Fox Wikis (thanks to Russell Campbell).

If you want to see this error fixed, please visit the bug link, download the sample, follow the instructions, validate the bug and vote to fix it.

VFP community count on you!

posted by emersonreed | 2 Comments
Filed Under:

A new project is on the way...

Currently, I'm working on a new project named ThemedControls.

This project includes new versions of OutlookNavBar (old Outlook2003Bar) and ZoomNavBar controls.

For now, I've made a short video (there's a link to download the zipped file at the bottom of this post) to let the community see what's coming in the next few days.

Enjoy it!

posted by emersonreed | 3 Comments
Filed Under:
Attachment(s): ThemedControls.zip

Here comes a new control... ZoomNavBar!

A long time ago I saw a very cool control (I don't remember where) that "zoom" the image button when it receives the focus. So I think... I could do something like this in VFP!

After some days working at my lunch time in this project, I finally have a beta version.

Take a look at this screenshot:

At the bottom of this post there's a link to download a zip file including the class and a sample (with a help) on how to use this control.

Is this cool? So help me to improve it giving some feedback, suggestions or reporting bugs.

VFP rocks!

 

 

posted by emersonreed | 16 Comments
Filed Under:
Attachment(s): ZoomNavBar_100.zip

OutlookNavBar control preview (Attached file updated)

Like I said in some VFP forums, I'm working on a new control named OutlookNavBar (download the project clicking in the link at the end of this post).

This new control basically do the same that Outlook2003Bar does, but not use GDI+ to create images and handle Themes tasks using a new class named ThemesManager.

Now the project has two classes:

OutlookNavBar.vcx - with the new improved control based on Outlook2003Bar;

ThemedControls.vcx - with lot of "themed" controls and a subclass of OutlookNavBar named ThemedOutlookNavBar.

How this new ThemedControls class work?

Firstly you need to do is create an object based on ThemesManager control and place them in a property named ThemesManager on _Screen and destroy the object when it will not used anymore - as you can see in Load and Unload method of ThemedForm control.
This object will be used to handle all theme changes.

So, create a form and place the controls from ThemedControls class and voila!

Take a look at Sample form to a better view of how this class works.

ASAP, I will post more details.

Feel free to make comments, send suggestions or report any bug.

Here is a screenshot...

posted by emersonreed | 22 Comments
Filed Under:
Attachment(s): OutlookNavBar_NewPreview.zip

Outlook2003Bar Version 1.0.2, a VFPX project

I've posted a new Outlook2003Bar version at VFPX.
Download here.

This version has a bug fix with Citrix environment.

Read the help file in Outlook2003Bar\VCX folder to know how to use the control.

Please, feel free to make comments, send suggestions or request bug fixes.

VFP rocks!


This control is part of VFPX, a Visual FoxPro Community effort to create open source add-ons for Visual FoxPro 9.0.

 

posted by emersonreed | 3 Comments
Filed Under:

I am tagged! (Too late...)

I know that the "Tag Game" stopped a long days ago, but I've been very busy and can't answer to César Chalom and Rick Borup (both "tagged" me) until now, but better late than never...

1. Despite of living in São Paulo, I'm a Flamengo's fan (Rio de Janeiro soccer team)! 
Everybody always asked me why... 
My father was Santos's fan and my mother is Palmeiras's fan. They ever tried to influence me, but at that time, Flamengo had a great team (Zico, Junior, Andrade, Adílio, Nunes, Leandro and company) and they won a lot of championships (World Soccer's Team, Brazilian and Carioca) and I had never seen another team play like this. So I decided to be a fan of the Flamengo! 
  
2. I don't smoke and don't drink. 
  
3. I love music! My favorite bands are: Jars of Clay, dc Talk, Newsboys, Third Day, Kutless, Oficina G3, Resgate, U2, a-ha, New Order, Tears for Fears, Information Society and Kon Kan. 
I also like to watch some TV Series like Smallville, The O. C., Seventh Heaven and Everwood. 
  
4. When I'm nervous, I have a bad habit to scratch my head. My wife and my little daughter always reprehend me, but I still didn't get to stop. I think that I get this soon, because my wife helped me to stop another bad habit a few years ago: to gnaw nails. 
  
5. When I began to date Georgea (my beloved wife), she told me that she was seated in a chair behind me in Baptist Church in my baptism day and that Angelica (my mother-in-law) said to her: "Oh, there is a beautiful boy in your front!" and she responded "I saw no one". 
I want to say to Georgea: despite of this, honey, I still loving you!   ; )

I would like to "tag" these people:

posted by emersonreed | 3 Comments

SplitterBar class

I've developed a SplitterBar class and would like to receive some feedback about them.

Features:
- Anchor
- Collapse/expand "panels"

Download the post attachment file below and unzip them.
Open the project and run Form1, Form2 and Form3 samples.
Try to "resize" the panels or click on the "arrows".

The class will only work with VFP 9.

Please, send suggestions or report bugs.

This class is based on Christof Wollenhaupt class.

posted by emersonreed | 4 Comments
Filed Under:
Attachment(s): SplitterBar.zip

Outlook2003Bar Version 1.0.1, a VFPX project

I've posted a new Outlook2003Bar version at VFPX.
Download here.

This version has minor bug fixes and some help updates.

Read the help file in Outlook2003Bar\VCX folder to know how to use the control.

Please, feel free to make comments, send suggestions or request bug fixes.

VFP rocks!


This control is part of VFPX, a Visual FoxPro Community effort to create open source add-ons for Visual FoxPro 9.0.

 

posted by emersonreed | 0 Comments
Filed Under:

Outlook2003Bar control is part of VFPX now!

As everybody can see in my previous posts, from July I start to develop a control (entirely written in VFP) with the same look and feel of the Microsoft Outlook 2003 shortcut bar.
After some days developing, I've posted a beta version of control, waiting for a feedback from VFP community.
With a positive feedback, I start to improve the control and, after one month (in August), the control was completed.
Again, I've posted the control and publish them in a famous site about VFP.
With a great repercussion, the control was downloaded more than 3.000 times!
From the beggining, the only intent, was contribute with VFP community, by the fact that this community always help me.
So, to make the control more notorious and share his code with the community, I've submitted the project to VFPX managers.
VFPX is an effort from VFP community (mentioned in a monthly letter from VFP development team manager) to create open source "add-ins", complementing Microsoft efforts with Sedna code named project, to extend VFP9 functionalities.
The project was approved and receive a lot of recommendations from VFPX managers (community famous members: Craig Boyd, Doug Hennig and Rick Schummer) for your simple usage and polishedness.
Now, Outlook2003Bar control is part of VFPX and every member can suggest, test, report bugs and participate in development!
 
Recommendations:
 
Thanks for doing such a fine job on the Outlook 2003-styled Listbar.
It's very polished and it is simple to use (given your use of pageframe and pages with just a few simple properties to set).
I look forward to seeing more of your work.
I am quite impressed.
Craig Boyd (SweetPotato Software CEO, Inc. and VFPX manager)
 
We think you and your team will do some really great things with this project, and provide a great deal of value for the Visual FoxPro Community.
Rick Schummer (VFPX manager)
 
O projeto "Outlook2003Bar" do nosso colega Emerson Santon Reed acaba de ser aprovado e incluído ao VFP-X.
Isso confirma a excelente idéia e ótima qualidade na execução do projeto que o Emerson lidera, ratificando todos os elogios que a classe tem recebido.
Estando no VFP-X, garante visibilidade ao projeto, abrindo-o para receber a contribuição da comunidade.
Parabéns Emerson !
César Chalom (Member of VFPX team and FoxBrasil user group)
 
Links:
 
A Visual FoxPro Community effort to create open source add-ons for Visual FoxPro 9.0. The code, classes, and libraries made available here will complement Microsoft's continuing efforts to improve and extend Visual FoxPro with the code named Sedna project which is outlined at http://msdn.com/vfoxpro/roadmap
 
Foxite
Home of the Visual FoxPro Experts
 
Worldwide Developers Community
posted by emersonreed | 2 Comments
Filed Under:

A sample on how to add features to Report Listener

VFP 9 introduces a new reporting system based on listeners (object-assisted output).

Listeners can be customized in a variety of ways and there's a lot of amazing things you can do with it.

If you combine the power of GDI+ with customized listeners you can highly increase the reporting capabilities.

I'll show how you can customize the Report Listener to create a watermark in all report pages and how you can customize Report Preview to change the language of report preview toolbar buttons and display the preview window maximized.

Set Classlib To (Addbs(Home()) + "FFC\_GDIPlus.vcx") Additive

* Create a Report Listener object
Local loReportListener
loReportListener = Newobject("MyReportListener")
With loReportListener
   .ListenerType = 1 && Preview
   * Set the Watermark properties: text, font and style
   .cWatermark = "Watermark demo"
   .cFontName = "Verdana"
   .nFontStyle = 1 && Bold
Endwith

* Create a cursor that will be the report data source and insert some records
Create Cursor curTest (field1 c(100))
Local i
For i=1 To 640
   Insert Into curTest Values (Str(i)+" test, test, test, test, test, test, test, test, test, test, test, test, test")
Endfor
Select curTest
Go Top

* Create a report on the fly
Create Report Test From curTest

* Run the report using the new report engine (object-assisted output)
Report Form Test Object loReportListener

* Close cursor and delete the report file
Use In curTest
Delete File Test.fr?
Return

* Create a class derived from _ReportListener base class and add some features
Define Class MyReportListener As _ReportListener Of Addbs(Home()) + "FFC\_ReportListener.VCX"
   * Internal to the class
   Hidden nAngle, oBrush, oColor, oFont, oGDIGraphics, oRect, oStringFormat
   Hidden ResourceStatus
   nAngle = 0
   oBrush = Null
   oColor = Null
   oFont = Null
   oGDIGraphics = Null
   oRect = Null
   oStringFormat = Null
   cResourceStatus = Set("Resource")
   * Public
   cWatermark = ""
   cFontName = ""
   nFontStyle = 0
   *
   Procedure Init
      Lparameters cWatermark, cFontName, cFontStyle
      Set Resource Off
      With This
         .cWatermark = Evl(cWatermark,"")
         .cFontName = Evl(cFontName,"")
         .nFontStyle = Evl(cFontStyle,0)
      Endwith
      DoDefault()
   Endproc
   *
   Procedure Destroy
      Local lcResourceStatus
      lcResourceStatus = This.cResourceStatus
      Set Resource &lcResourceStatus
      DoDefault()
   Endproc
   *
   Procedure LoadReport
      DoDefault()
      With This
         If .ListenerType==1 And Not Vartype(.PreviewContainer)=="O"
            .ExtendPreviewContainer()
         Endif
      Endwith
   Endproc
   *
   Procedure BeforeReport
      DoDefault()
      With This
         If Not Empty(.cWatermark)
            .oGDIGraphics = Createobject('GPGraphics')
            .SetWatermarkFontSize()
         Endif
      Endwith
   Endproc
   *
   Procedure AfterBand(nBandObjCode, nFRXRecNo)
      If nBandObjCode==7 && Page footer
         With This
            If Not Empty(.cWatermark)
               .AddWatermark()
            Endif
         Endwith
      Endif
      DoDefault(nBandObjCode, nFRXRecNo)
   Endproc
   *
   Function SetWatermarkFontSize
      With This
         .SetoGDIGraphicsHandle()

         * Create a semi transparent Grey Color
         .oColor = Createobject('gpColor',128,128,128,127)

         * Create a SolidBrush with Grey Color
         .oBrush = Createobject("gpSolidBrush", .oColor)

         * Create a StringFormat
         #Define StringAlignmentNear 0
         #Define StringAlignmentCenter 1
         #Define StringAlignmentFar  2
         .oStringFormat = Createobject('gpStringFormat')
         With .oStringFormat
            .Create()
            .Alignment = StringAlignmentCenter
            .LineAlignment = StringAlignmentCenter
         Endwith

         * Create a Font object
         Local loFont
         loFont = Createobject("GpFont")

         Local lnFactor, lnMaxWidth
         lnFactor = 0.80
         lnMaxWidth = (Sqrt((.SharedPageHeight ^ 2) + (.SharedPageWidth ^ 2))) * lnFactor

         * To bypass GDI+ MeasureString bug to obtain the correct size
         Local loStringFormat As 'GpStringFormat' Of Home() + 'FFC\_gdiplus.vcx'
         loStringFormat = Newobject('GpStringFormat',Home() + 'FFC\_gdiplus.vcx')
         loStringFormat.Create()
         loStringFormat.GetGenericTypographic()

         Local loSize, lnSize, lnCharsFitted, lnLinesFilled, lnPerc
         lnSize = 1500

         loFont.Create(.cFontName,lnSize,.nFontStyle,2)
         lnCharsFitted = 0
         lnLinesFilled = 0
         loSize = .oGDIGraphics.MeasureStringA(.cWatermark,loFont, ,;
            loStringFormat, @lnCharsFitted, @lnLinesFilled)

         If Vartype(loSize)=="O"
            If loSize.W > lnMaxWidth
               lnPerc = loSize.W / lnMaxWidth
               lnSize = Int(lnSize / lnPerc)
            Endif
         Endif

         loFont.Create(.cFontName,lnSize,.nFontStyle,2)
         .oFont = loFont

         * Calculate the rotation angle
         .nAngle = Rtod(Atan(.SharedPageHeight / .SharedPageWidth ))

         * Create a rectangle with special dimensions
         .oRect = Createobject("gpRectangle", ;
            -.SharedPageWidth/2, -.SharedPageHeight/2, ;
            .SharedPageWidth*2, .SharedPageHeight*2)
      Endwith
   Endfunc
   *
   Function AddWatermark
      With This
         .SetoGDIGraphicsHandle()

         * Prepare transformation
         .oGDIGraphics.TranslateTransform(.SharedPageWidth/2, ;
            .SharedPageHeight/2)
         .oGDIGraphics.RotateTransform(-.nAngle)
         .oGDIGraphics.TranslateTransform(-.SharedPageWidth/2, ;
            -.SharedPageHeight/2)

         * Draw a string
         .oGDIGraphics.DrawStringA(.cWatermark, .oFont, .oRect, .oStringFormat, .oBrush)

         * Reset Rotation
         .oGDIGraphics.ResetTransform()
      Endwith
   Endfunc
   *
   Function SetoGDIGraphicsHandle
      With This
         If Not .IsSuccessor
            .SharedGDIPlusGraphics = .GDIPlusGraphics
         Endif
         .oGDIGraphics.SetHandle(.SharedGDIPlusGraphics)
         .oGDIGraphics.TextRenderingHint = 3 && AntiAlias
      Endwith
   Endfunc
   *
   Function ExtendPreviewContainer
      Local loPreviewContainer
      loPreviewContainer = Null
      Do (_ReportPreview) With loPreviewContainer
      loPreviewContainer.SetExtensionHandler(Newobject("MyExtensionHandler"))
      This.PreviewContainer = loPreviewContainer
   Endfunc
Enddefine

* Create a class that will extend Report Preview
Define Class MyExtensionHandler As Custom
   *
   Procedure Show(iStyle)
      With This.PreviewForm
         With .Toolbar
            * Translate toolbar buttons ToolTips to Brazilian Portugese language
            .cboZoom.ToolTipText = "Zoom"
            .cmdClose.ToolTipText = "Fechar a visualização"
            .cmdGoToPage.ToolTipText = "Ir para a página"
            .cmdPrint.ToolTipText = "Imprimir"
            With .cntNext
               .cmdBottom.ToolTipText = "Última página"
               .cmdForward.ToolTipText = "Próxima página"
            Endwith
            With .cntPrev
               .cmdBack.ToolTipText = "Página anterior"
               .cmdTop.ToolTipText = "Primeira página"
            Endwith
            With .opgPageCount
               .opt1.ToolTipText = "Uma página"
               .opt2.ToolTipText = "Duas páginas"
               .opt3.ToolTipText = "Quatro páginas"
            Endwith
            *
         Endwith
         .WindowState = 2 && Maximize report preview
      Endwith
      DoDefault(iStyle)
   Endproc
   *
Enddefine

To know more about the new VFP 9 reporting system and GDI+, I recomend you to:

  • read VFP 9 help topics: Understanding Visual FoxPro Object-Assisted Reporting and Using GDI+ in Reports;
  • take a look at VFPX website and search for GDIPlusX class that extends GDI+ capabilities;
  • visit César Chalom's blog. He is involved in GDIPlusX project from VFPX team. His blog has great GDI+ samples.

One more time, thanks to César Chalom for develop the code to do the watermark. Congratulations for your great job!

posted by emersonreed | 5 Comments
Filed Under:

Outlook2003Bar New Version 1.0.0

In the last days, I worked on a new version of the Outlook2003Bar control, making some adjusts and adding new features.

The look has minor changes...

New features:

1) Now you don't need to add the buttons manually! The only thing you need to do is add the pages in the Panes pageframe control inside Outlook2003Bar and set: Caption, Picture16 and Picture24 page's properties and the control will automatically create the buttons at runtime.

2) Added predefined color schemes that follows Blue, Silver and Olive Windows XP Themes. If you change the active Windows XP theme, the control color scheme is changed too! Also, you can manually change the control's colors.

3) Outlook2003Bar help file is avaiable in Vcx directory.

Note that the size of the image used in PanelButtons changed from 32x32 to 24x24!

After download Outlook2003Bar attached, open Sample.pjx, compile them and run Sample.exe.

Please, feel free to make comments, send suggestions or request bug fixes.

VFP rocks!

posted by emersonreed | 12 Comments
Filed Under:
Attachment(s): Outlook2003Bar_1-0-0.zip
More Posts Next page »