Navigation:  Classes > bBrowser >

bBrowser:DataView

Print this Topic    Previous pageReturn to chapter overviewNext page

Purpose

An object of class bViewStyle for formatting column values.

Class

bBrowser

Type

Access / Assign

Data Type

bViewStyle

Description

With the DataView the graphic representation of column values can be affected. It can be used to set the font, the alignment, the foreground and the background color, grid settings and additional options for the formatting.

 

Additionally, each column can also define its own DataView. In this case when drawing a column value, the properties of both DataView objects are mixed but the properties of the Column DataView have higher priority.

 

So that changes that were made in the DataView are also shown in the browser, it must be immediately redrawn with the method bBrowser:Redraw().

 

Important note!
After creating a bBrowser control the access contains a bViewStyle object in which a Grid is already defined.

Samples

In the following sample a browser is created in which all columns are displayed with a red foreground and a yellow background color. Only the "2" column is displayed with a blue background color.

 

LOCAL odbsCUSTOMER AS DBServer

LOCAL oBrowser     AS bBrowser

LOCAL oColumn      AS bDataColumn

 

// create browser and show it

odbsCUSTOMER := DBServer{"CUSTOMER"}

oBrowser := bBrowser{oOwner,;

                                               1000,;

                                               Point{0, 0},;

                                               Dimension{300, 250}}

oBrowser:Use(odbsCUSTOMER)

oBrowser:Show()

 

// all columns with red text and yellow background color

IF oBrowser:DataView=NULL_OBJECT

       oBrowser:DataView := bViewStyle{Color{COLORRED},;

                                                                       Brush{Color{COLORYELLOW}}}

ELSE

         oBrowser:DataView:Foreground := Color{COLORRED}

       oBrowser:DataView:Background := Brush{Color{COLORYELLOW}}

ENDIF

 

// 2. column with blue background color

oColum := oBrowser:GetOpenColumn(2)

oColumn:DataView := bViewStyle{ , Brush{Color{COLORBLUE}}}

 

// IMPORTANT!!!

// -> Reread data and redraw browser

oBrowser:Refresh()

oBrowser:Redraw()

 

In the following sample a browser is created in which the background is displayed in the standard background color of Windows for the area without column data.

 

Note:
This sample does not use a DataView object it presents an alternate solution to the problem.

 

LOCAL odbsCUSTOMER        AS DBServer

LOCAL oBrowser            AS bBrowser

LOCAL iColor              AS DWORD

LOCAL iRed, iGreen, iBlue AS DWORD

LOCAL oBrush              AS Brush

 

// create browser and show it

odbsCUSTOMER := DBServer{"CUSTOMER"}

oBrowser := bBrowser{oOwner,;

                                               1000,;

                                               Point{0, 0},;

                                               Dimension{300, 250}}

oBrowser:Use(odbsCUSTOMER)

oBrowser:Show()

 

// determine the standard background color of Windows

iColor := GetSysColor(COLOR_3DFACE)

 

// convert background color in brush object

iRed := GetRValue(iColor)

iGreen := GetGValue(iColor)

iBlue := GetBValue(iColor)

oBrush := Brush{Color{iRed, iGreen, iBlue}}

 

// set background color of browser

oBrowser:Background := oBrush

See Also

bBrowser:CaptionView

bBrowser:FocusView

bBrowser:Font()

bBrowser:FooterView

bBrowser:InfoView

bBrowser:Redraw()

bBrowser:Refresh()

bBrowser:SelectorView

bBrowser:TitleView

bBrowser:WallpaperView

bBrowserColumn:DataView

 


Page url: http://www.YOURSERVER.com/index.html?bbrowser_dataview.htm