Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * ini bukan bikinan saya
- * ini saya co pas dari https://www.foxite.com/archives/grid-0000236901.htm
- Public oForm
- oForm = Createobject('myForm')
- oForm.Show
- Define Class myform As Form
- Height = 350
- Width = 600
- DataSession =2
- Add Object hflex As OleControl With ;
- Height = 350, ;
- Width = 600, ;
- Name = "Hflex", ;
- OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'
- Procedure Load
- Use (_samples+"data\employee")
- Endproc
- Procedure SetFlex
- Select employee
- With This.hflex
- .Rows = Reccount('employee')+2
- .Cols = 6
- .FixedRows = 2
- .FixedCols = 0
- .Mergecells = 3
- For ix = 0 To .Rows-1
- .MergeRow(m.ix) = .T.
- Endfor
- For ix = 0 To .Cols-1
- .MergeCol(m.ix) = .T.
- Endfor
- .FillStyle = 1
- .ColWidth(2,0) = 3000
- .ColWidth(3,0) = 1200
- .Row = 0
- .Col = 0
- .Rowsel = 1
- .Colsel = .Cols-1
- .CellAlignment = 4
- .Row = 2
- .Col = 0
- .Rowsel = .Rows-1
- .Colsel = .Cols-1
- .CellAlignment = 1
- Store 'Name' To ;
- .TextMatrix(0,0),;
- .TextMatrix(0,1)
- Store 'Address' To ;
- .TextMatrix(0,2),;
- .TextMatrix(0,3),;
- .TextMatrix(0,4),;
- .TextMatrix(0,5)
- .TextMatrix(1,0) ='First Name'
- .TextMatrix(1,1) ='Last Name'
- .TextMatrix(1,2) ='Street'
- .TextMatrix(1,3) ='City'
- .TextMatrix(1,4) ='Region'
- .TextMatrix(1,5) ='Country'
- Scan
- .TextMatrix(Recno()+1,0) = first_name
- .TextMatrix(Recno()+1,1) = last_name
- .TextMatrix(Recno()+1,2) = address
- .TextMatrix(Recno()+1,3) = city
- .TextMatrix(Recno()+1,4) = Region
- .TextMatrix(Recno()+1,5) = country
- .Row = Recno()+1
- .Col = 0
- .Rowsel = .Rows-1
- .Colsel = .Cols-1
- Do Case
- Case country = 'USA'
- .Cellbackcolor = 0xC0FFFF
- Case country = 'UK'
- .Cellbackcolor = 0xFFFFC0
- Case country = 'France'
- .Cellbackcolor = 0xFFC0FF
- Otherwise
- .Cellbackcolor = 0xC0C0C0
- Endcase
- Endscan
- Endwith
- Endproc
- Procedure Init
- This.SetFlex()
- Endproc
- Enddefi
- * ini saya co pas dari https://www.foxite.com/archives/grid-0000236901.htm
- Public oForm
- oForm = Createobject('myForm')
- oForm.Show
- Define Class myform As Form
- Height = 350
- Width = 600
- DataSession =2
- Add Object hflex As OleControl With ;
- Height = 350, ;
- Width = 600, ;
- Name = "Hflex", ;
- OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'
- Procedure Load
- Use (_samples+"data\employee")
- Endproc
- Procedure SetFlex
- Select employee
- With This.hflex
- .Rows = Reccount('employee')+2
- .Cols = 6
- .FixedRows = 2
- .FixedCols = 0
- .Mergecells = 3
- For ix = 0 To .Rows-1
- .MergeRow(m.ix) = .T.
- Endfor
- For ix = 0 To .Cols-1
- .MergeCol(m.ix) = .T.
- Endfor
- .FillStyle = 1
- .ColWidth(2,0) = 3000
- .ColWidth(3,0) = 1200
- .Row = 0
- .Col = 0
- .Rowsel = 1
- .Colsel = .Cols-1
- .CellAlignment = 4
- .Row = 2
- .Col = 0
- .Rowsel = .Rows-1
- .Colsel = .Cols-1
- .CellAlignment = 1
- Store 'Name' To ;
- .TextMatrix(0,0),;
- .TextMatrix(0,1)
- Store 'Address' To ;
- .TextMatrix(0,2),;
- .TextMatrix(0,3),;
- .TextMatrix(0,4),;
- .TextMatrix(0,5)
- .TextMatrix(1,0) ='First Name'
- .TextMatrix(1,1) ='Last Name'
- .TextMatrix(1,2) ='Street'
- .TextMatrix(1,3) ='City'
- .TextMatrix(1,4) ='Region'
- .TextMatrix(1,5) ='Country'
- Scan
- .TextMatrix(Recno()+1,0) = first_name
- .TextMatrix(Recno()+1,1) = last_name
- .TextMatrix(Recno()+1,2) = address
- .TextMatrix(Recno()+1,3) = city
- .TextMatrix(Recno()+1,4) = Region
- .TextMatrix(Recno()+1,5) = country
- .Row = Recno()+1
- .Col = 0
- .Rowsel = .Rows-1
- .Colsel = .Cols-1
- Do Case
- Case country = 'USA'
- .Cellbackcolor = 0xC0FFFF
- Case country = 'UK'
- .Cellbackcolor = 0xFFFFC0
- Case country = 'France'
- .Cellbackcolor = 0xFFC0FF
- Otherwise
- .Cellbackcolor = 0xC0C0C0
- Endcase
- Endscan
- Endwith
- Endproc
- Procedure Init
- This.SetFlex()
- Endproc
- Enddefine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement