Tabel Editing Data base Ver 2.0
Posted: Fri Jun 13, 2014 10:55 am
Editable table linked to a database

sample code for the above table
Ver 2.0
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
For the addition of column
WARNING: The first column must include the unique key of the table (hide with the flag)
A place in the event loop (Event=WaitwindowEvent ou WindowEvent)
For a link with another table
idColumn=The column to link
dbTableLink$=Secondary table
dbColumnLink$=Secondary column
dbReturnLink$=Secondary column displayed
Customizing the table
Added ability to sort, search ( type LIKE), resizing column
Choice of column used to sort departure
Optional graphical configuration
First of use LoadFont()
News vers 2.0
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)
to make the column requiered and/of single
Wath is expeted after....
Adding a new line to add a record in the database
Excuse me, my English is not very good

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