Skip to content

Using Resource Themes in CommandBars and Grids

The CommandBars and grids have some theme changes for themes. CommandBars support three new visual themes for peVisualTheme. These are:

  • xtpThemeVisualStudio2008
  • xtpThemeVisualStudio6
  • xtpThemeVisualStudio2010

In addition, xtpThemeOffice2007 has been renamed to xtpThemeResource, which will be explained below.

In grids, the property peColumnStyle has replaced xtpColumnOffice2007 with xtpColumnResource.

In grids, peToolTipStyle has replaced xtpToolTipOffice2007 with xtpToolTipResource.

In our packages, you can use these new "resource" names or the old ones, and they will work the same. However, the resource styles have an extra ability, which allows you to further set a theme from one of three DLLs that they provide. Each DLL can have multiple INI sub-themes (colors). An interface has been created for CommandBars and grids which lets you load these resources named LoadResourceImagesFromFile. After you load the resource, you must set the visual theme property to the appropriate Resource constant.

The following shows how you might do this. You can test this to see what this looks like by making the following changes to the order:

  1. Copy the three theme DLLs from \lib into \programs. Those are:
  2. Office2007.dll
  3. Office2010.dll
  4. Windows7.dll

  5. Replace the Application object in order.src with the following:

Object oApplication is a cApplication
    Set psCompany to "Data Access Worldwide"
    Set psProduct to "DataFlex Examples"
    Set psVersion to "17.1"
    Set psProgram to "Order"
    Set psHelpFile to "DevelopmentGuide.chm"
    Set peHelpType to htHtmlHelp

    Procedure NewStyle String ByRef sFile String ByRef sIni
        // Move "Office2007.dll" to sFile
        // Move "Office2007Aqua.ini" to sIni
        // Move "Office2007.dll" to sFile
        // Move "Office2007Black.ini" to sIni
        // Move "Office2007.dll" to sFile
        // Move "Office2007Blue.ini" to sIni
        // Move "Office2007.dll" to sFile
        // Move "Office2007Silver.ini" to sIni
        // Move "Office2010.dll" to sFile
        // Move "Office2010Black.ini" to sIni
        // Move "Office2010.dll" to sFile
        // Move "Office2010Blue.ini" to sIni
        // Move "Office2010.dll" to sFile
        // Move "Office2010Silver.ini" to sIni
        Move "Windows7.dll" to sFile
        Move "Windows7Blue.ini" to sIni
    End_Procedure
End_Object
  1. Replace this event in the CommandBars object in Order.src:
Procedure OnCreateCommandBars
    String sFile sIni
    Boolean bOk
    Forward Send OnCreateCommandBars
    Send NewStyle of ghoApplication (&sFile) (&sIni)
    If (sFile <> "") Begin
        Get LoadResourceImagesFromFile sFile sIni to bOk
        If bOk Begin
            Set peVisualTheme to xtpThemeResource
        End
    End
End_Procedure
  1. Add this event to the oOrderDtl_Grid object in Order.vw:
Procedure OnCreateGridControl
    String sFile sIni
    Boolean bOk
    Forward Send OnCreateGridControl
    Send NewStyle of ghoApplication (&sFile) (&sIni)
    If (sFile <> "") Begin
        Get LoadResourceImagesFromFile sFile sIni to bOk
        If bOk Begin
            Set peColumnStyle to xtpColumnResource
            Set peTooltipStyle to xtpToolTipResource
        End
    End
End_Procedure
  1. In the NewStyle procedure in Order.src, comment out the various DLL/INI pairs you want to test.

See Also