Using Microsoft Project Central Controls with Another Data Source

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Microsoft® Project Central controls can be customized for use with another data source, such as a Microsoft Access database (*.mdb). By using Microsoft Project Central ActiveX® controls, you can develop custom solutions for use in your own applications or in a digital dashboard.

This article explains how to bind a data source different from the Microsoft Project Central database to the grid/Gantt control (pjgrid.ocx) for use in an HTML file. With a Microsoft Project Central client access license, you can extend the functionality of the grid/Gantt control to other applications and develop new applications that use the control.

The Microsoft Download Center contains an example HTML page (Sample.htm) that uses the grid/Gantt control (pjgrid.ocx) to display project information stored in an Access database. This article describes the properties, methods, and events in pjgrid.ocx so that you can add to the code and customize the way the data are displayed in Sample.htm.

Microsoft Project Central Controls

The table below identifies and describes the ActiveX controls for Microsoft Project Central. All of the following controls are installed with a default installation of Microsoft Project Central.

Control Description
PJOUTLOOK.OCX Pulls tasks and calendar entries from Microsoft Outlook® and converts them into ActiveX Data Objects (ADO) recordsets that the grid can understand. This control warns the user before it reads from Outlook, so it can’t be used to access Outlook information without the user being aware.
PJOFFLINE.OCX Caches pages for offline use when users switch to offline mode.
PJQUERY.OCX General-purpose control for all miscellaneous client utility functions.
PJSECURITY.OCX Handles Microsoft Project Central security.
PJUPDATE.OCX Updates tasks and calendar entries from Microsoft Project Central into Microsoft Project.
PJCALENDAR.OCX Drop-down calendar for picking dates.
PJGRID.OCX Grid control that displays task details, the timesheet, and the Gantt Chart.
PJTEXTCONV.DLL Text converter control that converts raw numeric data into strings, and vice-versa.
PJRES9C.DLL Loads strings and bitmaps from the resource dynamic-link libraries (DLLs).
PJ9ENUC.DLL A resource DLL that contains the English strings and bitmaps used by the grid and the text converter; there are separate DLLs for other languages.

Customizing Microsoft Project Central Controls

This section describes how to bind a data source different from the Microsoft Project Central database to the grid/Gantt control (pjgrid.ocx). Included below are instructions for downloading the files, accessing the database through a virtual server, and altering the JavaScript in Sample.htm to control the way data are displayed in the grid.

Using Customizations

You may want to customize the Microsoft Project Central controls to:

  • Add functionality to Microsoft Project Central pages. You could use the grid/Gantt control to display cost data. You could create a new page within Microsoft Project Central to display this information, or you could add it to an existing page in Microsoft Project Central.
  • Display Microsoft Outlook tasks in a graphical format in the Gantt control. You could use the object model to save Microsoft Outlook tasks to a text file and then render them in the Microsoft Project Central grid.
  • Present ActiveX controls in a digital dashboard. You could present the control in a digital dashboard you’re creating. The Digital Dashboard Resource Kit provides information about the exposed properties and methods of the controls.

Installing the Example Files

The Microsoft Download Center includes five files that, together, show how you can bind the grid/Gantt control to data in an Access database. The file Sample.htm queries the database Gantt.mdb to display content in the same way that Microsoft Project Central does. The files are listed below:

  • Sample.htm   The script file that displays the grid control that connects to the database
  • Gantt.mdb   Sample database referred to in Sample.htm
  • Zoomout.gif, goto.gif, zoomin.gif   Image files used in Sample.htm

The files should be copied to a Web-shared folder (for example, c:\inetpub\wwwroot) or to any physical folder on your Microsoft Project Central server machine. If you are copying the files to a physical folder, create a virtual root (vroot) in the Internet Service Manager in Microsoft Internet Information Services (IIS). For more information on creating virtual roots, see the article Indexing with Internet Information Services.

Customizing Sample.htm

The file Sample.htm displays data from Gantt.mdb in a format that uses the Microsoft Project Central grid control. You can change the way information from Gantt.mdb is displayed in this HTML page by adding to, deleting, and editing the JavaScript in Sample.htm.

In the file Sample.htm, change the string "myserver," located in the RDS object in line 33, to the name of the server where Gantt.mdb is located. For more information on using the remote data services of ADO, see the article HOWTO: Use RDS Within a Visual Basic ActiveX Document. For more information on setting up a data source name (DSN), see the Setting up a DSN for Gantt.mdb section later in this article.

The Init() function in Sample.htm is the location where the display properties are set. The code is listed below:

function Init() {
   RDS.SQL = "Select * from ASSIGNMENTS";
   RDS.Refresh();

   MSPJGrid.Binding = RDS.RecordSet;
   MSPJGrid.FieldList = "WASSN_ID[Task ID],#TASK_NAME[Task Name],
+ASSN_START_DATE[Start],+ASSN_FINISH_DATE[Finish],+ASSN_WORK[Work],
+ASSN_REM_WORK[Remaining Work]";
   MSPJGrid.GroupBy = 'ASSN_START_DATE';
   MSPJGrid.SetSortBy('TASK_NAME',0);
   MSPJGrid.Outlining = false;
   MSPJGrid.GanttView = true;
   MSPJGrid.Refresh();
}

Note

   

This command is separated into several lines for display purposes only.

As it is configured above, the Init() function displays a two-pane view: The left pane displays the Task ID, Task Name, Start, Finish, Work, and Remaining Work fields, and the right pane displays the Gantt bars. The table below gives a line-by-line description of each of the actions performed by the Init() function:

Action Description
RDS.SQL = "Select * from ASSIGNMENTS";
Sets the select statement to be used to retrieve a recordset by RDS
RDS.Refresh();
Runs the select statement
MSPJGrid.Binding = RDS.RecordSet;
Binds the grid to the recordset retrieved through RDS so that the grid can display data from Gantt.mdb
MSPJGrid.FieldList="WASSN_ID[Task ID],
#TASK_NAME[Task Name],
+ASSN_START_DATE[Start],
+ASSN_FINISH_DATE[Finish],
+ASSN_WORK[Work],
+ASSN_REM_WORK[Remaining Work]";
Note   This command is separated into several lines for display purposes only.
Identifies which fields to display in the grid and how to display the columns of the recordset. See the grid FieldList property for more details about naming conventions.
MSPJGrid.GroupBy = 'ASSN_START_DATE';
Groups the rows of the grid by the ASSN_START_DATE field
MSPJGrid.SetSortBy('TASK_NAME',0);
Sorts the rows of the grid by the TASK_NAME field in ascending order (indicated by 0)
MSPJGrid.Outlining = false;
Disables outlining for the grid (this function is only used in Microsoft Project Central)
MSPJGrid.GanttView = true;
Shows the Gantt bars on the right pane of the grid
MSPJGrid.Refresh();
Refreshes the grid with all the options set above

Setting up Gantt.mdb

Database fields

The sample Gantt.mdb database contains only the Assignments table, which has the following fields:

Field name Description
WASSN_ID Assignment ID
TASK_NAME Name of the assignment and task
ASSN_START_DATE Assignment start date
ASSN_FINISH_DATE Assignment finish date
ASSN_WORK Assignment work
ASSN_REM_WORK Assignment remaining work

Note

   

When writing to the database, assignment start and finish dates can be expressed as a normal date (for example, 08/20/2000), but assignment work and remaining work must be expressed using the formula

work = number of minutes * 1000

(for example, 6 hours = 360000). You can enter information in the grid as "6" or "6h"; the pjtextconv.dll converts the string to the raw numeric data.

Setting up a DSN for Gantt.mdb

You need to make sure that there is a DSN created for Gantt.mdb called WebGanttDb. The DSN must exist on the machine that is going to be serving up Gantt.mdb. The DSN is necessary because the sample script uses remote data services (RDS) to access this database with open database connectivity (ODBC) drivers.

To set up a DSN using Windows 2000 Server or Advanced Server:

  1. On the Start Menu, point to Administrative Tools, and click Data Sources (ODBC).
  2. Click the System DSN tab.
  3. Click Add.
  4. Select Microsoft Access Driver (*.mdb) from the list.
  5. Click Finish.
  6. In the ODBC Microsoft Access Setup dialog box, Enter WebGanttDB in the Data Source Name box.
  7. Click Select. In the Directories box, select Gantt.mdb from the location on your hard drive where it is saved.

Field List details

In Gantt.mdb, you can define columns in the Init() function using the FieldList property that specifies the columns to be displayed in the left and right panes of the grid.

For detailed information about field lists, see the FieldList property section later in this article. The FieldList property section also provides examples of syntax used to define fields in the grid.

Important Licensing Information

The use of any Microsoft Project Central components, including ActiveX controls such as the grid/Gantt controls and Active Server Pages, requires a Microsoft Project Central client license for each user. The Microsoft Project Central End-User License Agreement (EULA) contains the specific rights and restrictions and can be viewed during setup. See the Microsoft Project Central License Pack FINAL EULA 10-05-99.

Microsoft Project Central licenses can be obtained at authorized value-added resellers (VARs) and distributors, and directly from Microsoft. Licenses are not available through retail channels.

Microsoft Project Central Grid Control Properties, Methods, and Events

This portion of the article describes in detail the different properties, methods, and events used in the grid/Gantt control for Microsoft Project Central. Each property, method, and event might also include a list of constants or an example.

Notes

  • Grid column names are the displayed text in the column headers of the grid. Recordset field names are the database field names of the columns of the data source that the grid binds to. For example, the recordset that the grid binds to may have a field with the name RES_NAME, but this field may be displayed in the grid column with the user-friendly column header of "Resource Name". In the FieldList property, this can be represented by "RES_NAME[Resource Name]".
  • Some items below refer to absolute rows or columns, while others refer to grid rows or columns. Absolute row numbers are the number of rows from the first row, whether or not the first row is visible. In contrast, the grid row is the row number from the first visible row in the grid.
  • In some methods, there are optional settings, denoted by [brackets] around the optional property.

Properties

The following reference is an alphabetical list of all the active properties associated with pjgrid.ocx. Click the property name to view its description.

Property ActualsFinishDate As Variant

Property ActualsPeriod As Long

Property ActualsStartDate As Variant

Property ActualsType As Long

Property AutoFilter As Long

Property AutoFilterList As String

Property Binding As Object

Property CurrentRows As Variant (read-only)

Property DefaultFinishTime As Variant

Property DefaultSortDirection As Long

Property DefaultStartTime As Variant

Property DividerPos As Long

Property FieldList As String

Property FieldList2 As String

Property FieldListArray As Variant

Property FieldListArray2 As Variant

Property Filter As String

Property GanttStartDate As Long

Property GanttSummaryRollup As Long

Property GanttTimeScaleZoom As Long

Property GanttView As Long

Property GroupBy As Variant

Property HideIndicIcon As Long

Property LCID As Long

Property MaxGridHeight As Long (read-only)

Property MaxGridWidth As Long (read-only)

Property MultiSelect As Boolean

Property SelectEntireRow As Boolean

Property SortBy As String (read-only)

Property SortDirection As Long (read-only)

Property TextConv As Object (read-only)

Property TextDirection As Long

Property Total As Long

Property WeekStartOn As Long

Property ActualsFinishDate As Variant

Sets the end date of the timesheet interval to be displayed. The date is expressed in VT_date format.

Top

Property ActualsPeriod As Long

Sets the timesheet interval displayed. The following table outlines the constants and their descriptions.

Value Description
0 Entire period
1 Daily
2 Weekly

Top

Property ActualsStartDate As Variant

Sets the start date of the timesheet interval to be displayed. The date is expressed in VT_date format.

Top

Property ActualsType As Long

Sets the timesheet data type displayed. The following table outlines the constants and their descriptions.

Value Description
1 Planned work
2 Actual work
3 Planned and actual work
4 Overtime work
5 Planned and overtime work
6 Actual and overtime work
7 Planned, actual, and overtime work

Top

Property AutoFilter As Long

Sets the status of the AutoFilter as turned on (0) or off (1).

Top

Property AutoFilterList As String

Gets the current AutoFilter settings as a string. The format of the string is the same as that of a normal Filter property: [column name] [>, >=, <, <=, =, <>] [value] [and, or].

This property can also be used to set the AutoFilter setting for the grid. The table below lists detailed information on filter criteria.

Comparison string Description
> The value of [column name] is greater than [value].
>= The value of [column name] is greater than or equal to [value].
< The value of [column name] is less than [value].
<= The value of [column name] is less than or equal to [value].
= The value of [column name] equals [value].
<> The value of [column name] does not equal [value].

Note

   

Setting an AutoFilter should be used in conjunction with retrieving the values. To avoid inconsistent behavior, don't set it with your own values; set the Autofilter with the values you retrieve.

Top

Property Binding As Object

Takes in an ADO recordset object that contains the primary data to be displayed in the grid. This property is set-only.

Top

Property CurrentRows As Variant (read-only)

Gets a variant array containing the selected row numbers (row numbers start at 0 from the top of the grid regardless of scrolling) in the grid.

For example, if rows 2, 3, 4, and 6 are selected in the grid:

  • var rows = MSPJGrid.CurrentRows,
  • rows.getItem(0) is 2,
  • rows.getItem(2) is 4, and
  • rows.getItem(3) is 6.

Top

Property DefaultFinishTime As Variant

Sets or gets the default finish time (in VT_date format) that is used to round Gantt bars up or down when Gantt bars are rounded to whole days.

Top

Property DefaultSortDirection As Long

Sets or gets the default sort direction using the SetSortBy method in the function Init(). This is the initial sort direction when a column is sorted:

Value Description
0 Ascending
1 Descending

Top

Property DefaultStartTime As Variant

Sets or gets the default start time (in VT_date format) that is used to round Gantt bars up or down when Gantt bars are rounded to whole days.

Top

Property DividerPos As Long

Sets or gets the pane divider position in number of pixels from the left edge of the grid.

Top

Property FieldList As String

Sets or gets a string that specifies what kinds of columns are to be displayed in the left pane of the grid. In its simplest form, the list is a comma-delimited list of field names to be displayed in the grid in the order they are listed. Be sure first to indicate the field name that corresponds to the field name in Gantt.mdb. The following table describes the field list syntax:

Syntax Description
...,... Comma separates the columns
[...] Name to display on column header
{...} Width in pixels of column
<...> Text converter type of field (see table below)
+... Makes column editable
#... Marks column as the outlining column (the +/- symbols and group names will show up in this column)

The following table is a list of values of different field types, along with a brief description, that can be displayed in the grid.

Value Description
3 Index into constraint table - ASAP, ALAP
4 Dates
5 Percent
6 Duration - "1d"
8 Work - "5h"
9 Cost - "$5"
11 Cost rate - "$5/hr"
13 Index into accrual table - Start, End, Prorated
14 Index into contour table - Flat, Turtle, Double Peak, Bell
15 A plain number
16 Index into Boolean string table - True, False
17 Index into yes no string table - Yes, No
18 A double value
21 A string value
23 Minutes since 12:00am (midnight)
25 Index to type of links - SS, FF, FS, SF
28 Elapsed duration values - "5ed"
29 Task type: Fixed units, fixed work, fixed duration
30 Hyperlink
47 Enumerated type 1
48 Enumerated type 2
49 Enumerated type 3

Note

   

The three enumerated types are a set of customizable number-string pairs. These can be set dynamically with the grid method InitEnumType (type#, value, text). There is no difference among the three enumerated types, but you should make certain that the type corresponds to the value when calling the array (for example, type 2 needs to correspond to 48). An example is listed below:

   var rgValues = new Array();
   var rgStrings = new Array();
   rgValues[0] = 1;     rgStrings[0] = "AAA";
   rgValues[1] = 2;     rgStrings[1] = "BBB";
   rgValues[2] = 3;     rgStrings[2] = "CCC";
   MSPJGrid.InitEnumType(2, rgValues, rgStrings);
   MSPJGrid.FieldList="#DB_NAME[Name]{60},DB_DATE[Birthday]<4>,
+DB_ENUM<48>,MSPJWCFieldIndicators(DB_sample)[Sample]";

In the field list above, two arrays are created that define the custom enumerated types for the drop-down list you want to create. , The drop-down list has the values "AAA," "BBB," and "CCC," and displays one of these depending on the value in the database field DB_ENUM.

The FieldList property first creates a column called "Name" that is 60 pixels wide. Next, it creates a second column named "Birthday," which displays a date. Next, it creates a third column called "DB_ENUM" with a drop-down list containing the values defined in the array. The fourth column called "Sample" displays several indicators based on the fields DB_sample and DB_sampleIndicator.

MSPJWCFieldIndicators indicates that the column will be displayed as a bitmap indicator with the real value in the tooltip. The grid only knows how to display the indicators and not how to calculate which bitmap it needs to display. Therefore, you must specify the bitmap number in a separate column. The column name must correspond to the number in parentheses with the word Indicator appended to the field name. In the example listed above, the database field DB_sample will display the indicator specified in the database column DB_sampleIndicator.

Top

Property FieldList2 As String

Same as FieldList except that it applies to the right pane. Setting this property in the Init() function automatically creates the right pane for the grid.

For example: MSPJGrid.FieldList2="#TASK_NAME[Task Name],+ASSN_REM_WORK[Remaining Work]"; creates a right pane displaying the TASK_NAME column with the friendly name "Task Name" and the ASSN_REM_WORK column with the friendly name "Remaining Work."

**CAUTION   **Avoid displaying the same columns in both panes. For example, if you update information in column X in the left pane, the data will not be updated in column X in the right pane until you refresh the view.

Top

Property FieldListArray As Variant

Same as FieldList except that each column is an element of the array rather than being separated by commas in a string. This property is set-only.

Top

Property FieldListArray2 As Variant

Same as FieldList2 except that each column is an element of the array rather than being separated by commas in a string. This property is set-only.

Top

Property Filter As String

Sets or gets the current filter applied to the grid as a string of the format:

[column name] [>, >=, <, <=, =, <>] [value] [and,or] 
[column name] [>, >=, <, <=, =, <>] [value]

The column name is the name of the column in the recordset passed in through the Binding property.

For example:

MSPJGrid.Filter = "TASK_NAME = ‘n’ and NUM > 5" 

In this example, the grid will filter for all the rows that have "n" in the TASK_NAME column and have values greater than 5 in the NUM column.

Top

Property GanttStartDate As Long

Sets or gets the starting date for the portion of the Gantt Chart displayed. The date required is a project date (number of milliseconds since 1/1/84), which can be obtained by using the text converter object.

Top

Property GanttSummaryRollup As Long

Sets whether subtask Gantt bars roll up into the summary bar when the summary row is collapsed.

Top

Property GanttTimeScaleZoom As Long

Sets or gets the Gantt Chart timescale granularity. The values range from –3 (zoom in) to 6 (zoom out).

Top

Property GanttView As Long

Sets or gets whether the right pane of the grid displays a Gantt Chart.

Top

Property GroupBy As Variant

Sets the first grouping in the grid. The grouping should be specified as a string that contains the recordset column name to be grouped on. An optional display column can be specified in brackets so that the grouping row will display this value instead of the actual grouped value. This option is useful when you want to group by an ID but display the text for it in the grouping rows.

For example:

MSPJGrid.GroupBy = "RES_ID[RES_NAME]"

Groups the rows by the value in the RES_ID column while displaying each grouping row with the value in the RES_NAME column. Setting this property is exactly the same as calling SetGroupBy(0, string)

Top

Property HideIndicIcon As Long

Hides the indicator column icon at the column header. This property is set-only.

Top

Property LCID As Long

Sets or gets the locale ID for the grid.

Top

Property MaxGridHeight As Long (read-only)

Gets the maximum possible grid height required to display all the grid rows in pixels.

Top

Property MaxGridWidth As Long (read-only)

Gets the maximum possible grid width required to display all the grid columns in pixels.

Top

Property MultiSelect As Boolean

Sets whether it is possible to select more than one cell in the grid. If this is set to false and SelectEntireRow is set to true, then clicking a cell selects an entire row (more than one cell but only one row at a time).

Top

Property SelectEntireRow As Boolean

When set to true, clicking any cell selects the entire row that the cell is in. This property is get or set.

Top

Property SortBy As String (read-only)

Returns the column name or the database field name that is sorted. See Sub SetSortBy****for more information on the sort string syntax.

Top

Property SortDirection As Long (read-only)

Gets the current sort direction of the column that is sorted.

Top

Property TextConv As Object (read-only)

Gets the text converter object that is used in the grid. The text converter is the driver (pjtextconv.dll) responsible for converting raw numeric data into strings, and vice-versa.

Top

Property TextDirection As Long

Sets the text direction, as specified in the following table:

Value Description
0 Left to right
1 Right to left

Top

Property Total As Long

Sets or gets whether the grid will display a "Totals" row at the bottom of the grid that sums up all the rows.

Top

Property WeekStartOn As Long

Sets or gets the starting day of the week for defining weekly intervals in the timesheet. The grid defaults to Sunday if this property is not set. Additional values are listed in the table below:

Value Description
0 Sunday
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday

Top

Methods

The following reference is an alphabetical list of all the active methods associated with pjgrid.ocx. Click the method name to view its description.

Sub CollapseTimeScale()

Sub ExpandTimeScale()

Function GetCellValue(rowNum As Long, FieldName As String)

Function GetCurrentCol([PaneNum As Long]) As Long

Function GetCurrentRow([PaneNum As Long]) As Long

Function GetFieldName(PaneNum As Long, colNum As Long, [fDBName As Long]) As String

Function GetFirstNonGroupRow([PaneNum As Long]) As Long

Function GetFirstVisibleColumn(PaneNum As Long) As Long

Function GetNumColumns(PaneNum As Long) As Long

Function GetNumRows(PaneNum As Long) As Long

Function GetTextForCell(PaneNum As Long, row As Long, col As Long) As String

Sub GotoSelectedTask()

Sub InitEnumType(TypeNum As Long, rgValues, rgStrings)

Function IsCellEditable(PaneNum As Long, col As Long, row As Long) As Long

Sub Refresh([PaneNum As Long = -1])

Sub SetBasicProperties(newVal As Object, FieldList As String, newVal2 As Object, StartDate, FinishDate, Period As Long, ActualsType As Long)

Sub SetCellValue(PaneNum As Long, row As Long, Column As Long, strValue As String)

Sub SetColumnTitleColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sub SetCurrencySettings(bstrSymbol As String, lPosition As Long, lDigits As Long)

Sub SetCurrentCell(PaneNum As Long, col As Long, row As Long)

Sub SetDelegRowColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sub SetEditableCellColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long, [PaneNum As Long = -1])

Sub SetFirstVisibleColumn(PaneNum As Long, Column As Long)

Sub SetGanttStyle(lStyleType As Long, fShow As Long, lBarType As Long, lBarPattern As Long, lBarColor As Long, [lStartShape As Long], [lStartColor As Long], [lEndShape As Long], [lEndColor As Long])

Sub SetGroupBy(num As Long, Val)

Sub SetReadOnlyCellColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long, [PaneNum As Long = -1])

Sub SetRowTitleColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sub SetSortBy(colVal, [lDirection As Long = -1])

Sub SetSpecialRowColor(lType As Long, lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sub SetWaitCursor()

Sub CollapseTimeScale()

Zooms in the Gantt Chart timescale by one level.

Top

Sub ExpandTimeScale()

Zooms out the Gantt Chart timescale by one level.

Top

Function GetCellValue(rowNum As Long, FieldName As String)

Gets the contents of a cell in the absolute row specified and the grid column name or recordset field name specified.

Top

Function GetCurrentCol([PaneNum As Long]) As Long

Gets the absolute column number of the current cell selection for the left pane by default. PaneNum is 0 by default. If PaneNum is 1, then it gets the selected column number for the right pane. If multiple cells are selected by dragging, it returns the leftmost column number selected. If multiple nonadjacent cells are selected by holding down the CTRL key while clicking, it returns the first column number selected.

Top

Function GetCurrentRow([PaneNum As Long]) As Long

Gets the absolute row number of the current cell selection for the left pane by default. PaneNum is 0 by default. If PaneNum is 1, then it gets the selected row number for the right pane. If multiple cells are selected by dragging, it returns the top most row number selected. If multiple nonadjacent cells are selected by holding down the CTRL key while clicking, it returns the first row number selected.

Top

Function GetFieldName(PaneNum As Long, colNum As Long, [fDBName As Long]) As String

Gets either the display column name (default) or the recordset field name (fDBName = true) for the absolute column number (colNum) in the pane specified (PaneNum: 0 = left, 1 = right).

Top

Function GetFirstNonGroupRow([PaneNum As Long]) As Long

Gets the absolute row number of the topmost row that is not a grouping row.

Top

Function GetFirstVisibleColumn(PaneNum As Long) As Long

Gets the absolute column number for the leftmost grid column that is currently visible.

Top

Function GetNumColumns(PaneNum As Long) As Long

Gets the number of absolute columns for each pane.

Top

Function GetNumRows(PaneNum As Long) As Long

Gets the number of absolute rows for each pane. This number could be different for the panes when the timescale is displayed on the right pane.

Top

Function GetTextForCell(PaneNum As Long, row As Long, col As Long) As String

Gets the string value of a cell based on absolute row and column numbers of a particular pane (PaneNum).

Top

Sub GotoSelectedTask()

Tells the grid to set the Gantt Chart timescale to display the Gantt bar of the selected task.

Top

Sub InitEnumType(TypeNum As Long, rgValues, rgStrings)

The enumerated types are a set of number-string pairs. It is possible to create three enumeration types (TypeNum: 1-3), which can be set dynamically with this method. InitEnumType takes in two equal-length arrays of values and strings that represent a number-string pair.

For example:

var rsValues = new Array();
var rsStrings = new Array();
rsValues[0] = 1;    rsStrings[0] = "AAA";
rsValues[1] = 2;    rsStrings[1] = "BBB";
rsValues[2] = 3;    rsStrings[2] = "CCC";
MSPJGrid.InitEnumType(2, rgValues, rgStrings);

This creates an enumerated type (textconv type 48) that has the strings "AAA," "BBB," and "CCC" as possible display values.

Top

Function IsCellEditable(PaneNum As Long, col As Long, row As Long) As Long

Returns whether a cell, specified by the absolute row and column numbers, can be edited.

Top

Sub Refresh([PaneNum As Long = -1])

Refreshes the grid with any settings. This should be called after setting properties or calling methods in order to propagate the changes. The default refreshes both panes unless a pane number is specified (PaneNum: 0 = left, 1 = right).

Top

Sub SetBasicProperties(newVal As Object, FieldList As String, newVal2 As Object, StartDate, FinishDate, Period As Long, ActualsType As Long)

Sets all of the following properties at one time: Binding, FieldList, ActualsBinding (assumes sorted actuals), ActualsStartDate, ActualsFinishDate, ActualsPeriod, and ActualsType. You may find this method useful as a time-saving device.

Top

Sub SetCellValue(PaneNum As Long, row As Long, Column As Long, strValue As String)

Sets a cell in the absolute row and column of a pane with a string value (strValue).

Top

Sub SetColumnTitleColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sets the column title cell colors to be an RGB value. Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get additional varieties of dithering. The patterns are described in the table below. The color dithering patterns are dithered on top of an RGB color to provide a different shade of the color.

Number Dithering pattern
0 Hollow
1 Solid
2 Light gray pattern
3 Gray pattern
4 Dark gray pattern
5 \\\\\\\\\
6 /////////
7 XXXXXXXX
8 |||||||||
9 ---------
10 +++++++++
11 || || || || ||
12 Very light gray

Top

Sub SetCurrencySettings(bstrSymbol As String, lPosition As Long, lDigits As Long)

Sets grid-wide settings for all the currencies (Text converter type 9 and 11) displayed in the grid. bstrSymbol is the currency symbol, lPosition is the currency symbol position, and lDigits is the number of decimal digits to be displayed. The text converter control (pjtextconv.dll) converts raw numeric data into strings, and vice-versa.

Top

Sub SetCurrentCell(PaneNum As Long, col As Long, row As Long)

Sets the currently selected cell to be the cell in the row, column, and pane specified.

**Note   **The SetCurrentCell method must be called after the grid has been displayed on a page. The page either needs to be refreshed, or else the following line needs to be place in the Init() function:

MSPJGrid.Refresh();

Top

Sub SetDelegRowColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sets the row colors of a delegated row. Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get dithering. The patterns are described in the table under Sub SetColumnTitleColor.

Top

Sub SetEditableCellColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long, [PaneNum As Long = -1])

Sets the cell colors of all editable cells in the pane specified (default is both panes). Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get dithering. The patterns are described in the table under Sub SetColumnTitleColor.

Top

Sub SetFirstVisibleColumn(PaneNum As Long, Column As Long)

Scrolls the grid to display the absolute column specified as the first visible grid column for the pane specified.

Top

Sub SetGanttStyle(lStyleType As Long, fShow As Long, lBarType As Long, lBarPattern As Long, lBarColor As Long, [lStartShape As Long], [lStartColor As Long], [lEndShape As Long], [lEndColor As Long])

Sets the bar and start or end colors and shapes for a particular type of Gantt bar. fShow determines whether the particular Gantt bar type should be displayed (1) or not (0).

For example,

SetGanttStyle(5,1,1,1,1,2,1,2,1);

The above example shows a summary task bar in the shape of a rectangle with a solid fill pattern and black house-down shapes on either end.

lStyleType has the following values:

Value Description
0 Normal task
1 Critical task
2 External task
3 Delegated task
4 Milestone
5 Summary task
6 Project Summary
7 Group by summary
8 Progress
9 Summary progress
10 Baseline task
11 Baseline summary
12 Baseline milestone
13 Pre-leveled task
14 Pre-leveled summary
15 Pre-leveled milestone
16 Split
17 Critical split
18 Baseline split
19 Deadline
20 Slack
21 Slippage
22 Delay
23 Custom duration 1
24 Custom duration 2
25 Custom duration 3
26 Custom duration 4
27 Custom duration 5
28 Custom duration 6
29 Custom duration 7
30 Custom duration 8
31 Custom duration 9
32 Custom duration 10
33 Early schedule
34 Late schedule
35 External milestone

lBarType has the following values:

Value Description
0 None
1 Rectangle
2 Rectangle top
3 Rectangle middle
4 Rectangle bottom
5 Line top
6 Line middle
7 Line bottom

lBarPattern has the following values:

Value Description
0 Hollow
1 Solid fill
2 Light fill
3 Medium fill
4 Dark fill
5 Diagonal left
6 Diagonal right
7 Diagonal cross
8 Line vertical
9 Line horizontal
10 Line cross

All of the color parameters have the following values:

Value Description
1 Black
2 Red
3 Yellow
4 Lime
5 Aqua
6 Blue
7 Fuchsia
8 White
9 Maroon
10 Green
11 Olive
12 Navy
13 Purple
14 Teal
15 Gray
16 Silver

All of the shape parameters have the following values:

Value Description
0 No shape
1 House up
2 House down
3 Diamond
4 Triangle up
5 Triangle down
6 Triangle right
7 Triangle left
8 Arrow up
9 Caret down top
10 Caret up bottom
11 Line shape
12 Square
13 Circle diamond
14 Arrow down
15 Circle triangle up
16 Circle triangle down
17 Circle arrow up
18 Circle arrow down
19 Circle
20 Star

Top

Sub SetGroupBy(num As Long, Val)

Sets the grouping in the grid. The grouping should be specified as a string that contains the recordset column name to be grouped on. There is an optional display column that can be specified in brackets so that the grouping row displays this value instead of the actual grouped value. This option is useful when you want to group by an ID but display the text for it in the grouping rows.

For example: callingMSPJGrid.SetGroupBy(0,"RES_ID[RES_NAME]")groups the rows by the value in the RES_ID column while displaying each grouping row with the value in the RES_NAME column. The 0 in the first parameter specifies that this should be the first level of grouping. You can set up to 4 levels of grouping (0-3).

Top

Sub SetReadOnlyCellColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long, [PaneNum As Long = -1])

Sets the cell colors of all read-only cells in the pane specified (default is both panes). Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get dithering. The patterns are described in the table under Sub SetColumnTitleColor.

Top

Sub SetRowTitleColor(lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sets the cell colors of row title column (the left most column in the grid with no column title) for both panes. Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get various dithering. The patterns are described in the table under Sub SetColumnTitleColor.

Top

Sub SetSortBy(colVal, [lDirection As Long = -1])

Sets the column to be sorted on. The colVal could either be an absolute column number or a grid column name or a recordset field name. This method only works with the left pane. The lDirection specifies the direction of sorting:

Value Description
0 Ascending
1 Descending

Top

Sub SetSpecialRowColor(lType As Long, lRed As Long, lGreen As Long, lBlue As Long, lPattern As Long)

Sets the row colors of special rows. Special rows are indexed by the lType value (1-10) and require that the bound recordset have a special field called TSpRowColor containing the numbers 1 to 10.

For example, a row can have a TSpRowColor value of 5. This row will be colored based on what is set with this method with the lType parameter as 5. Each RGB value ranges from 0 to 255. You can also apply patterns to the color to get various dithering. The patterns are described in the table under Sub SetColumnTitleColor.

Top

Sub SetWaitCursor()

Turns the cursor to the wait hourglass cursor until Refresh is called and has finished.

Top

Events

The following reference is an alphabetical list of all the active events associated with pjgrid.ocx. Click the event name to view its description.

Event OnClickEditableCell(col As Long, row As Long, PaneNum As Long)

Event OnClickHyperLink(col As Long, row As Long, Link As String, PaneNum As Long)

Event OnClickIndicator(col As Long, row As Long, IndicatorType As String, IndicatorValue As Long, PaneNum As Long)

Event OnClickNonEditableCell(col As Long, row As Long, PaneNum As Long)

Event OnDblClickEditableCell(col As Long, row As Long, PaneNum As Long)

Event OnDblClickIndicator(col As Long, row As Long, IndicatorType As String, IndicatorValue As Long, PaneNum As Long)

Event OnDblClickNonEditableCell(col As Long, row As Long, PaneNum As Long)

Event OnNewColumn(col As Long, PaneNum As Long)

Event OnNewRow(row As Long, PaneNum As Long)

Event OnResizeNeeded()

Event OnClickEditableCell(col As Long, row As Long, PaneNum As Long)

This event occurs when an editable cell is clicked. The cell’s absolute row and column numbers are passed on as parameters.

Top

This event occurs when a cell with a hyperlink in it is clicked. The link of the cell is passed on as Link.

Top

Event OnClickIndicator(col As Long, row As Long, IndicatorType As String, IndicatorValue As Long, PaneNum As Long)

This event occurs when an indicator is clicked. The indicator type is the name of the field that the indicator is based on. The indicator value is the value of that field.

For example, an indicator might be based on a Boolean field in the recordset. The IndicatorType string contains the name of the field and the IndicatorValue contains either true or false.

Top

Event OnClickNonEditableCell(col As Long, row As Long, PaneNum As Long)

This event occurs when a read-only cell is clicked. The cell’s absolute row and column numbers are passed on as parameters.

Top

Event OnDblClickEditableCell(col As Long, row As Long, PaneNum As Long)

This event occurs when an editable cell is double-clicked. The cell’s absolute row and column numbers are passed on as parameters.

Top

Event OnDblClickIndicator(col As Long, row As Long, IndicatorType As String, IndicatorValue As Long, PaneNum As Long)

This event occurs when an indicator is double-clicked. The parameters are the same as the single-click event.

Top

Event OnDblClickNonEditableCell(col As Long, row As Long, PaneNum As Long)

This event occurs when a read-only cell is double-clicked. The cell’s absolute row and column numbers are passed on as parameters.

Top

Event OnNewColumn(col As Long, PaneNum As Long)

This event occurs when a new column is selected. The column passed on as a parameter is the absolute column number.

Top

Event OnNewRow(row As Long, PaneNum As Long)

This event occurs when a new row is selected. The row passed in as a parameter is the absolute row number.

Top

Event OnResizeNeeded()

This event occurs when the number of rows displayed in the grid changes.

Top