Ok dann hätte ich auch noch paar links was Grid´s angeht.
schau mal hier:
xGrid
oder hier:
Grid-Lib
oder hier
eGrid
Das sollte erstmal reichen oder?
(Datenbank)-Grid
Hier mal ein Beispiel, wie man ein CS-Grid über eine Datenbank befüllt:
Code: Alles auswählen
If InitDatabase() = 0
MessageRequester("Error", "Can't initialize Database (ODBC v3 or better) environment", 0)
End
EndIf
OpenConsole()
If OpenDatabaseRequester(0)
Print("SQL Command: ")
Command$ = Input()
If DatabaseQuery(Command$)
hWnd = OpenWindow(0, 0, 0, 640, 240, #WS_OVERLAPPEDWINDOW, "Demo CS-Grid-Gadget with Database-Content")
If CreateGadgetList(WindowID())
Cols.l = DatabaseColumns() ; Explores Database-Columns-Count
test = CSGridGadget(#PB_Any,10,10,600,200,Cols,0) ; Creates a CS-Grid-Gadget (empty)
CSGridGadget_SetAutoRedraw(test,-1) ; Turns off Auto-Redraw for Grid for faster setup
CSGridGadget_SetColCaptionVisibility(test,1) ; Shows a column header (default empty caption)
CSGridGadget_SetRowCaptionVisibility(test,1) ; Shows a row header (default numbered caption)
For x = 0 To Cols-1 ; Step each column
CSGridGadget_SetColCaption(test,x,DatabaseColumnName(x)) ; Labels each column
Select DatabaseColumnType(x) ; Examine database-column-type
Case 1 ; Ganzzahl
CSGridGadget_SetColDataType(test,x,1) ; Defines formated output as integer
Case 3 ; Fließkomma
CSGridGadget_SetColDataType(test,x,16) ; Defines formated output as integer
EndSelect
Next
While NextDatabaseRow() ; Step each recordset / database-row
line.s = ""
For x = 0 To Cols-1 ; Step each column
line.s = line.s + GetDatabaseString(x) + Chr(10) ; Add each cell content to one line (separated with tab)
Next
CSGridGadget_AddRowWithContent(test,5,Left(line.s,Len(line.s)-1),CSGridGadget_GetColsCount) ; Adds a new line with content in columns 0-2
Wend
CSGridGadget_SetAutoRedraw(test,1) ; Turns on Auto-Redraw for Grid 1 after setup
CSGridGadget_Redraw(test) ; Redraws the Grid
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_C , 1) ; Set shortcut for Copy (Control+C)
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_V , 2) ; Set shortcut for Paste (Control+V)
Repeat
main_EventID = WaitWindowEvent()
CSevent = CSGridGadget_EventHandling(main_EventID) ; Processes all Grid-Gadget events (for all CS-Grid-Gadgets)
Select CSevent
EndSelect
If main_EventID = #PB_Event_Menu
Select EventMenuID()
Case 1 ; Ctrl + C
CSGridGadget_CopySelectionToClipboard(CSGridGadget_GetActualGrid()) ; Copy clipboard-content from grid
Case 2 ; Ctrl + V
CSGridGadget_PasteClipboardToSelection(CSGridGadget_GetActualGrid()) ; Paste clipboard-content to grid
EndSelect
EndIf
Until main_EventID = #PB_Event_CloseWindow
CSGridGadget_FreeGadget(test) ; Removes the Grid with all sub-objects and frees memory
End
EndIf
EndIf
EndIf
End