'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Dim gg As xnGrid
Dim bmp_m As Bitmap
Dim bmp_f As Bitmap
bmp_m.Initialize ( File.DirAssets , "male.png" )
bmp_f.Initialize ( File.DirAssets , "female.png" )
Dim flags(5) As Bitmap
flags(0).Initialize ( File.DirAssets , "flags_1.png" )
flags(1).Initialize ( File.DirAssets , "flags_2.png" )
flags(2).Initialize ( File.DirAssets , "flags_3.png" )
flags(3).Initialize ( File.DirAssets , "flags_4.png" )
flags(4).Initialize ( File.DirAssets , "flags_5.png" )
End Sub
Sub gg_fill
Dim n As Int
For n = 1 To 10
gg.RowAppend ( Array As String ("1", "Fiona Fiona Fiona Fiona", "Stanfill", "1" , "F" ) )
.....
Next
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim bt_paint As Button
Dim t As Int : t = 5dip
Dim h As Int : h = 45dip
' create buttons
bt_paint.Initialize("bt_paint")
bt_paint.Text = "create"
Activity.AddView ( bt_paint , 0dip , t , 90dip , 40dip )
t = t + h
' **************************************************************************
' create the grid object and then grid column objects
' **************************************************************************
If gg.IsInitialized = False Then
gg.Initialize("gg")
gg.FastScroll = False
gg.RowHeight = 30dip
gg.HeaderHeight = 30dip
gg.HeaderTextSize = 13
gg.RowTextSize = 13
gg.HeaderTextColor = Colors.Black
gg.RowTextColor = Colors.Black
gg.SelectedOddColor = Colors.Magenta
gg.SelectedEvenColor = Colors.Magenta
Dim c As xnGridCol
c = gg.ColCreateAndAppend2 ( "#" , "id" , 40dip , Gravity.TOP + Gravity.LEFT )
c = gg.ColCreateAndAppend2 ( "First Name" , "first_name" , 100dip , Gravity.TOP + Gravity.LEFT )
'c.SetTypeButton
c.RowHeight = 60dip
c = gg.ColCreateAndAppend2 ( "Family Name" , "family name" , 100dip , Gravity.TOP + Gravity.LEFT )
c = gg.ColCreateAndAppend2 ( "State" , "state" , 50dip , Gravity.LEFT )
c.RowIconTop = 2dip
c.RowIconLeft = 2dip
c.SetTypeImage
c.RowIconPut ( "1" , flags(0) )
c.RowIconPut ( "2" , flags(1) )
c.RowIconPut ( "3" , flags(2) )
c.RowIconPut ( "4" , flags(3) )
c.RowIconPut ( "5" , flags(4) )
c.PositionSet ( 2 , 3 , 1 , 1 )
c = gg.ColCreateAndAppend2 ( "Sex" , "sex" , 50dip , Gravity.LEFT )
c.RowIconTop = 2dip
c.RowIconLeft = 2dip
c.SetTypeImage
c.RowIconPut ( "M" , bmp_m )
c.RowIconPut ( "F" , bmp_f )
c.PositionSet ( 2 , 3 , 3 , 1 )
Activity.AddView ( gg , 5dip , t , 280dip , 100%y - t - 10dip )
' **************************************************************************
' fill the grid
' **************************************************************************
gg_fill
bt_paint_click
End If
End Sub
Sub bt_paint_click
gg.Multiselect = False
gg.GridWidth = 1dip
gg.RowEvenColor = Colors.RGB ( 240 , 255 , 255 )
gg.GridColor = Colors.Red
gg.PixelFix = False
gg.GridCreate2 ( True )
End Sub