[Gambas-user] for this new year:
Fabien Bodard
gambas.fr at ...626...
Tue Jan 1 13:28:42 CET 2008
This is a sympathic gambas demo, that show the class and object model power:
this class encapsulate a gridview and give it multi formating ability...
it is join with two classes:
CFormat :
An easy way to transport complex format information via a string (like in css
ans the font class)
this work this way :
CFormat[Value as String] as CFormat
When you pass a Format string it fill a new instanciate CFormat class
You can instanciate a cformat class this way too:
hFormat = New CFormat
The format string can contain :
Font as a font string (ex: Arial,Bold,10)
BackColor
ForeColor
Alignment (it use all the Align Class Keywords by calling them directly)
Format (Format$ pattern)
Width
Height
Padding
CFormat["BackColor: &HFF55FF; ForeColor: &HDD11DD; Font: Bold,10;"] etc
CFormat.ToString return a formated string
So To copy a CFormat :
hFormat = CFormat[oldFormat.ToString]
to store a format
Setting["format"] = hFormat.ToString
To restore
hFormat = CFormat[Setting["Format"]]
To get a value :
me.Width = hFormat.Width
Now the Contdition DB system :
A condition :
hCondtion new Conditions(Field, what, value, iftrue, iffalse)
a second condition imbricated condition (= to the AND keyword)
hConditions.Add(Field, what, value)
what = condtion comparison mode ex: Condtions.IsEqual
In The RichDataGrid only the ifTrue Value is used and you need to pass a
CFormat class.
The Rich DadaGrid now :
to set the Table
$hGrid = New RichDataGrid(GridView1)
$hGrid.Table = "MyTable"
$hGrid.Fields = ["Field1", "Field2", "Field3"]
'set the header shown text
$hGrid.Display = ["myName1", "MyName2",..]
$hGrid.Header = GidView.Horizontal
'here set a hcondtions class
$hGrid.CondFormats.add(hCondition)
you can add multiple conditions
'to setup the column format:
$hGrid.colFormat = [CFormat[...],
CFormat[...],
...]
I think i have forgotten many things here but can work a little bit to find
how all of that work.
Fabien Bodard
NOTE: The test database is required for the example !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RichDataGrid-0.0.8.tar.gz
Type: application/x-tgz
Size: 12514 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20080101/d7f0fc45/attachment.bin>
More information about the User
mailing list