
sample code for the above table
Code: Select all
UseSQLiteDatabase()
XIncludeFile "DataTable.pbi"
Global DataFile$=GetCurrentDirectory()+"DB\Teste.sqlite"
Global Event
;
Procedure OpenMainWindows()
Enumeration TbCivilite
#Id
#Pays
#Localite
#CodePostal
EndEnumeration
OpenWindow(0,0,0,800,600,"Teste",#PB_Window_SystemMenu)
Table::CreateTable(0,50,50,450,450,"Teste",DataFile$,"TbLocalite","","")
Table::AddColumn(0,#Id,"ID","id",150,#True)
Table::AddColumn(0,#Pays,"Pays","idPays",150)
Table::SetEditableColumn(0,#Pays,#True,0,0)
Table::AddColumn(0,#Localite,"Localite","localite",150)
Table::SetEditableColumn(0,#Localite,#True,Table::#TypeString,0)
Table::SetRequired(0,#Localite,#True,#True)
Table::AddColumn(0,#CodePostal,"Code postal","code_postal",150)
Table::SetEditableColumn(0,#CodePostal,#True,Table::#TypeString,0)
Table::AddLinkColumn(0,#Pays,"TbPays","id","pays")
Table::SetFlagColumn(0,#Localite,#True,#True,#True)
Table::SetFlagColumn(0,#CodePostal,#True,#True,#True)
; Table::SetLineHeight(0,80)
Table::SetOrderOnColumn(0,#Localite)
Table::DrawTable(0)
EndProcedure
OpenMainWindows()
;TesteLoc()
Repeat
Event=WaitWindowEvent()
Table::EventTable(0,Event)
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Debug Table::GetValue(0,#Localite)
EndSelect
EndSelect
Until Event=#PB_Event_CloseWindow
https://www.mediafire.com/?1oudyomu2igyy71
The column are editable directly with a right click of the mouse.
Data related tables are directly displayed in a combobox.
zip content:
DataTable.pbi
IMG (the picture for icone)
DB (the testing database)
Main.pb (for testing)
operation
To create the table
Code: Select all
CreateTable(idTable,X,Y,widht,height,title$,dataName$,dataTable$,user$,paseword$)
WARNING: The first column must include the unique key of the table (hide with the flag)
Code: Select all
AddColumn(idTable,idColumn,title$,dbColumn$,width,hide.b=#False)
Code: Select all
EventTable(idTable,Event)
For a link with another table
idColumn=The column to link
dbTableLink$=Secondary table
dbColumnLink$=Secondary column
dbReturnLink$=Secondary column displayed
Code: Select all
AddLinkColumn(idTable,idColumn,dbTableLink$,dbColumnLink$,dbReturnLink$)
Added ability to sort, search ( type LIKE), resizing column
Code: Select all
SetFlagColumn(idTable,idColumn,orderOn.b,chercheOn.b,redimOn.b)
Code: Select all
SetOrderOnColumn(idTable,idColumn,descOn.b=#False)
Code: Select all
SetLineHeight(idTable,height)
Code: Select all
SetLineColorPairImpair(idTable,colorPair,colorImpair)
Code: Select all
SetLineTileColor(idTable,colorBack,colorFont)
Code: Select all
SetLineTileColumnColor(idTable,colorBack,colorFont)
Code: Select all
SetRibonColor(idTable,colorBack,colorFont)
Code: Select all
SetTitleHeight(idTable,height)
Code: Select all
SetTitleColumnHeight(idTable,height)
Code: Select all
SetTextColor(idTable,color)
Code: Select all
SetFontTitle(idTable,font)
Code: Select all
SetFontTitleColumn(idTable,font)
Code: Select all
SetFontText(idTable,font)
to make the column editable (with direct update of database)
TypeEdit= The flag of stringGadget (number, upercase, lowercase, ect)
LenEdit =maximum len of the string (no inlemented now)
Code: Select all
SetEditableColumn(idTable,idColumn,EditableOn.b,TypeEdit,LenEdit)
Code: Select all
SetRequired(idTable,idColumn,RequiredOn,UniqueRecordOn)
Wath is expeted after....
Adding a new line to add a record in the database
Excuse me, my English is not very good