Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
TABLEVIEW - Use tableview
USE TABLEVIEW
To use tableview we create object : Dim TB as tableview TB=new tableview(me) Now we ajust numbers of column and rows : TB.columns.count=5 '5 columns TB.rows.count=21 '20 rows NOw we ajust the height and width for each column and row : TB.columns.width=100 TB.rows.height=20 Now we adjust column header : TB.header=1 '0 -> Aucune 1 -> horizontal 2 -> vertical 3 -> les deux TB.columns[0].title="Titre" TB.columns[0].width=50 TB.columns[1].title="Client" TB.columns[2].title="Facture" TB.columns[2].width=40 TB.columns[3].title="Etranger" TB.columns[3].width=50 TB.columns[4].title="type" TB.columns[4].width=50 now, the text color : im Linea as integer, SwColor as boolean, Rec as result, Sql as string, Cn as connection Sql="select * from clientes order by codigo" Rec=Cn.exec(sql) TB.rows.count=Rec.count+1 do while Rec.available TB[linea, 0].text = Rec!Codigo TB[linea, 0].Background = IIf(SwColor, COLOR.White, COLOR.Black) TB[linea, 0].Foreground = IIf(SwColor, COLOR.Black, COLOR.White) TB[linea, 0].Alignment = 2 TB[linea, 1].text = Rec!nombre TB[linea, 1].Background = IIf(SwColor, COLOR.White, COLOR.Black) TB[linea, 1].Foreground = IIf(SwColor, COLOR.Black, COLOR.White) TB[linea, 1].Alignment = 1 TB[linea, 2].text = Rec!dir TB[linea, 2].Background = IIf(SwColor, COLOR.White, COLOR.Black) TB[linea, 2].Foreground = IIf(SwColor, COLOR.Black, COLOR.White) TB[linea, 2].Alignment = 1 Rec.movenext Linea+=1 SwColor=NOT swcolor 'inversion de la couleur loop Edit cells : sub TB_change() dim Tabla as new string[] tabla.add("opcion 1") tabla.add("opcion 2") if TB.columnat=2 then TB.edit(tabla,true) 'para actualizar la celda se mostrará un combo con las opciones descritas ' la opción TRUE de readonly indica que solo se podrá elegir del combo. else TB.edit 'activar modo edición en celda en textbox endif end save in the sql database : sub TB_save(Row AS Integer, Column AS Integer, Value AS String) Dim Sql as string Sql="update clientes set codigo=" & TB[TB.row,0].text & "', nombre)'" & TB[TB.row,1].text & "', direccion='" & TB[TB.row,2].text & "'" Cn.exec(sql) end Creation date : 29/05/2009 @ 10:06 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|