What is the Best Way To Include the Data Grid Library?

When using Data Grids in your application you need to include the revDataGridLibrary.rev stack file in order for the Data Grids to work. This lesson will show you how to do this with the application framework.

Approach #1

The first approach to including the revDataGridLibrary.rev stack is to let the Revolution Standalone Builder do it. While this works fine the one drawback is that you have to rebuild your standalone if the data grid library is updated.

To use this approach follow the instructions in the Data Grid manual, using the glxappLauncher stack since that is the stack used to build a standalone.

Approach #2

The second approach is to manually include the revDataGridLibrary.rev stack. The benefit of this approach is that you can update the data grid library without having to rebuild a standalone. The following steps will show you how.

Locate revDataGridLibrary.rev Stack

Locate revDataGridLibrary.rev Stack

The revDataGridLibrary.rev stack is located in the Toolset folder (1) of the Revolution application folder (2).

Copy File Into Application Folder

Copy File Into Application Folder

Copy the revDataGridLibrary.rev file from the Toolset folder to your application folder. I'm storing the stack in the components folder.

Add Stack File As Standalone Resource

Add Stack File As Standalone Resource

Now we need to add the revDataGridLibrary.rev stack file as a standalone resource. A stack that is a standalone resource is not loaded by the framework which is what we want in this case. The Data Grid stack is always loaded by the IDE during development so we only need to load it when running as a standalone.

Open the IDE plugin and switch to the Standalone Resources tab. Click the Add File button.

Select the revDataGridLibrary.rev stack file in your application folder.

Set Output Folder

Set Output Folder

Since I'm storing the stack file in the components folder I am going to enter [[APPLICATION]]/components in the Relative output folder dialog. The [[APPLICATION]] string tells the framework to store the file in the Application bundle when creating an OS X standalone.

The Result

The Result

The revDataGridLibrary.rev stack file has now been added as a standalone resource. The last thing to do is specify which platforms it should be used on. Click in the OS X and Win columns.

The respective icons will appear meaning the stack file will be included when building a standalone for both platforms.

Load revDataGridLibrary.rev Stack

Load revDataGridLibrary.rev Stack

The last step is to load the stack file when running the application as a standalone. The Data Grid stack file MUST be available when stacks that use Data Grids are loaded. Otherwise the Data Grids will not work. You can load the revDataGridLibrary.rev stack file into memory in the glxapp_preloadApplication handler in the application stack script. This message is sent before any of your application stacks are loaded into memory.

==========

Copy & Paste

==========

on glxapp_preloadApplication

if the environment is not "development" then

put there is a stack (glxapp_getProp("executable folder") & \

"/components/revdatagridlibrary.rev") into theStackExists

end if

end glxapp_preloadApplication

2 Comments

Andre Garzia

If I use method 2 and bundle the data grid libraries with my own application, what happens if I open it on the IDE, will it conflict with Revolution owns data grid library? Both have same names...

Trevor DeVore

@andre: There will be no conflict. Since the Data Grid library is added as a Standalone Resource the framework does not load the library in the IDE. The library will only be included when you build a standalone.

Also notice that the code that manually loads the library (in glxapp_preloadApplication) only runs if not in "development" mode.

Add your comment

E-Mail me when someone replies to this comment