Part XI
Adding a grid function to the Toolkit
Add the new grid function to the master toolkit file \xb\xxx\xtool0.xxx
Each grid function that is shown in the Toolkit is listed
in the master toolkit file xtool0.xxx. This file acts as a switchboard to tell
the PDE where it can find each grid function and which BMP image is used to
represent the grid function in the Toolkit. There is one line per grid function,
and each line contains five fields separated on each side by one or more tabs.
They are listed in the order that they appear in the Toolkit window. The Grid
Type name should be the same as the Grid Function name.
DLL filename Grid Type Grid
Function Toolkit Image Category
=====================================================================
xb XuiPressButton
XuiPressButton xpress.bmp Button
...
calendar DsCalendar
DsCalendar calendar.bmp Calendar
I will add the above line for DsCalendar ( ) at the bottom of this file, and then rename the file xtool3.xxx.
Select the master toolkit file in \xb\xxx\xtoolkit.xxx
The file xtoolkit.xxx lists the filenames of master toolkit
files. The first enabled toolkit file will be the file that is used for the
PDE Toolkit Window. We want to use the new toolkit we just created above, xtool3.xxx,
so we will add this file to the list and enable it. We disable the other toolkits
by commenting them out.
' xtool0.xxx
' xtool1.xxx
xtool3.xxx
Create a BMP image
![]()
We will need an image for our new calendar grid. Toolkit
images must be 32x32 pixel 16-color bitmaps. You can alter one of the existing
toolkit images in \xb\xxx\ such as xpress.bmp and then save it with a new filename.
Place the image file in \xb\xxx\.
To use new grid function, IMPORT "myNewGridDll"
The standard GuiDesigner grid functions are available to
your program once you IMPORT "xui". In the same fashion, remember
that in order to use your grid function, your program must import the grid function
library. In our example we need the following IMPORT statement in the PROLOG
:
IMPORT "calendar"
Restart XB and Create a New GUI program

If we restart Xbasic and select File > New > Gui Program,
then open the Toolkit window, you will see that the calendar image has been
added to the bottom row of images in the Toolkit. If you select Window >
New from the Toolkit menu, you will be able to select the calendar grid and
add it to the new window just like any of the other grids. Viola!
Conclusion
(c) 2000 David SZAFRANSKI