Tuesday, February 14, 2006

From the Edge:
Dynamically Changing/Retrieving DBGrid Column Title and
Column Properties
Section: Forms and Form Designer (DBGrid Control)
Chapter: Running R:BASE Your Way!
Platform: R:BASE 7.5 and V-8 Turbo for Windows
Supported Builds: R:BASE 7.5 (7.5.24.30214 or higher)
        R:BASE V-8 Turbo (8.0.12.30214 or higher)

Using the PROPERTY and GETPROPERTY commands, now you can
dynamically change the DBGrid Column as well as the Column
Title properties.

Here's how:

Changing DB Grid Column Title Properties Using PROPERTY Command:

Keep in mind that the column numbers starts with "0". So, if
you wish to change the DBGrid Column Title for column numbers
2 and 3, you would refer this as column number 1 and 2 when
using the PROPERTY command.

Example 01:
Dynamically Changing DB Grid Column Title Properties using
PROPERTY Command

-- Start
PROPERTY <DBGRIDComponentID> TITLES[1]->CAPTION 'New Title Green'
PROPERTY <DBGRIDComponentID> TITLES[1]->COLOR 'GREEN'
PROPERTY <DBGRIDComponentID> TITLES[1]->FONT_COLOR 'WHITE'
PROPERTY <DBGRIDComponentID> TITLES[2]->CAPTION 'New Title Red'
PROPERTY <DBGRIDComponentID> TITLES[2]->COLOR 'RED'
PROPERTY <DBGRIDComponentID> TITLES[2]->FONT_COLOR 'WHITE'
RETURN
-- End

Changing DB Grid Column Properties Using PROPERTY Command:

Keep in mind that the column numbers starts with "0". So,
if you wish to change the DBGrid Column Properties for
column number 2 and 3, you would refer this as column numbers
1 and 2 when using the PROPERTY command.

Example 02:
Dynamically Changing DB Grid Column Properties using PROPERTY
Command

-- Start
PROPERTY <DBGRIDComponentID> COLUMNS[1]->COLOR 'GREEN'
PROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_COLOR 'WHITE'
PROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_NAME 'Arial'
PROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_SIZE 12
PROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_BOLD 'TRUE'
PROPERTY <DBGRIDComponentID> COLUMNS[2]->COLOR 'RED'
PROPERTY <DBGRIDComponentID> COLUMNS[2]->FONT_COLOR 'WHITE'
PROPERTY <DBGRIDComponentID> COLUMNS[2]->FONT_NAME 'MS Sans Serif'
PROPERTY <DBGRIDComponentID> COLUMNS[2]->FONT_SIZE 10
PROPERTY <DBGRIDComponentID> COLUMNS[2]->FONT_BOLD 'FALSE'
PROPERTY <DBGRIDComponentID> ROWSHEIGHT 20
RETURN
-- End

Retrieving DB Grid Column Title Properties Using GETPROPERTY
Command:

Keep in mind that the column numbers starts with "0". So,
if you wish to retrieve the DBGrid Column Title Properties
for column number 2 and 3, you would refer this as column
numbers 1 and 2 when using the GETPROPERTY command.

Example 03:
To Retrieve DB Grid Column Title Properties using GETPROPERTY
Command

-- Start
CLEAR VAR vCaption,vColor,vFontColor,vFontBold,vFontName, +
vFontSize
SET VARIABLE vCaption TEXT = NULL
SET VARIABLE vColor TEXT = NULL
SET VARIABLE vFontColor TEXT = NULL
SET VARIABLE vFontBold TEXT = NULL
SET VARIABLE vFontName TEXT = NULL
SET VARIABLE vFontSize TEXT = NULL
GETPROPERTY <DBGRIDComponentID> TITLES[1]->CAPTION vCaption
GETPROPERTY <DBGRIDComponentID> TITLES[1]->COLOR vColor
GETPROPERTY <DBGRIDComponentID> TITLES[1]->FONT_COLOR vFontColor
GETPROPERTY <DBGRIDComponentID> TITLES[1]->FONT_BOLD vFontBold
GETPROPERTY <DBGRIDComponentID> TITLES[1]->FONT_NAME vFontName
GETPROPERTY <DBGRIDComponentID> TITLES[1]->FONT_SIZE vFontSize
RETURN
-- End

Retrieving DB Grid Column Title Properties Using GETPROPERTY
Command:

Keep in mind that the column numbers starts with "0". So, if
you wish to retrieve the DBGrid Column Properties for column
number 2 and 3, you would refer this as column numbers 1 and
2 when using the GETPROPERTY command.

Example 04:
To Retrieve DB Grid Column Properties using GETPROPERTY Command

-- Start
CLEAR VAR vColor,vFontColor,vFontBold,vFontName,vFontSize
SET VARIABLE vColor TEXT = NULL
SET VARIABLE vFontColor TEXT = NULL
SET VARIABLE vFontBold TEXT = NULL
SET VARIABLE vFontName TEXT = NULL
SET VARIABLE vFontSize TEXT = NULL
GETPROPERTY <DBGRIDComponentID> COLUMNS[1]->COLOR vColor
GETPROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_COLOR vFontColor
GETPROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_BOLD vFontBold
GETPROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_NAME vFontName
GETPROPERTY <DBGRIDComponentID> COLUMNS[1]->FONT_SIZE vFontSize
RETURN
-- End

A PDF document is available at:

From The Edge: http://www.razzak.com/fte
(Powered by R:WEB Suite 3.0)

A sample form, "DBGridProperties", is available at the following
URL to demonstrate the use of Dynamically Changing//Retrieving
DBGrid Column Title and Column Properties. A few additional
properties are also demonstrated in this form.

Sample Applications: http://www.razzak.com/sampleapplications
(Powered by R:WEB Suite 3.0)

Enjoy and make sure to have fun with update 24!

Very Best R:egards,

Razzak.

Reply via email to