Maptitude GISDK Help |
Your own GISDK applications can use LoadResourceFile() to compile resources. LoadResourceFile() lets you specify the UI Database you want to use and the resource file you want to compile. You cannot use a list file with LoadResourceFile(), though you can easily create a GISDK macro loop to load any number of resource file in sequence. In fact, you can use GISDK to design and implement your own custom dialog box that lets you choose the resources you want to compile and the name of the target UI Database.
If you are creating a custom application, you can include the following two menu items and the associated GISDK macros in your application. This lets you compile resources by choosing the appropriate commands from your own application's menu system. (The code that follows can be found in the utils.rsc file in the gisdk\samples folder).
// Here are two menu items...
// Move these into your menu system.
// This one asks the user for the name of a resource file, and compiles it
Menuitem "Compile Resource" do RunMacro("load a resource file", null) end
// This one immediately re-compiles the last resource file that was compiled
Menuitem "Re-Compile" do RunMacro("reload a resource file") end
// This first macro loads a resource file...
Macro "load a resource file" (filename)
shared rsc_file_name
if filename = null then do
// Ask the user which file to compile...
on escape do Return() end
rsc_file_name = ChooseFile({{"Resource","*.rsc"}},
"Compile Resource", {{"ReadOnly Box", "No"}})
on escape default
end
else rsc_file_name=filename
SetCursor("Hourglass")
// Do some basic error trapping...
on notfound do
ResetCursor()
Return()
end
on error do
ResetCursor()
ShowMessage("Compilation Failed.")
Return()
end
// Compile the resource file into the current UI database
LoadResourceFile(,rsc_file_name,)
ResetCursor()
EndMacro
Macro "reload a resource file"
shared rsc_file_name
// See if something has already been compiled...
if rsc_file_name = null then
ShowMessage("No resource file was previously loaded.")
else
// Compile it again...
RunMacro("load a resource file", rsc_file_name)
endMacro
Never use LoadResourceFile() to compile a resource file that contains a menu or dialog box that is currently displayed. For example, suppose you are running a custom application that has menus and toolbars that you designed yourself. If you use LoadResourceFile() to compile the resource files that contain the menus and toolbars while those menus or toolbars are shown on the screen, your menus may cease to function.
©2025 Caliper Corporation | www.caliper.com |