Yes, ts-soft is totally right.
You can just remove this, because this is only required to create a DLL file with Tailbite.
Here is an example code, which is working on MacOSX, so it should be cleared of all this Tailbite stuff:
Code: Select all
; *****************************************************************
; ** CS-GRID V1.1 *** (c)2005 Christian Walde-Sauer, 27.10.2005 ***
; *****************************************************************
; * Stand 28.11.2005                                              *
; * GRID-Objekt zur Darstellung von speziellen Daten-Tabellen     *
; *****************************************************************
; *************************************************************
;- Konstanten
; *************************************************************
#EventID_Return = 98                    ; Ereignis-Kennung für die Return-Taste
#EventID_ESC = 99                       ; Ereignis-Kennung für die ESC-Taste
#EventID_Left = 100                     ; Ereignis-Kennung für die Pfeil-Links-Taste
#EventID_Up = 101                       ; Ereignis-Kennung für die Pfeil-Hoch-Taste
#EventID_Right = 102                    ; Ereignis-Kennung für die Pfeil-Rechts-Taste
#EventID_Down = 103                     ; Ereignis-Kennung für die Pfeil-Runter-Taste
#EventID_SLeft = 104                    ; Ereignis-Kennung für die Umschalt + Pfeil-Links-Taste
#EventID_SUp = 105                      ; Ereignis-Kennung für die Umschalt + Pfeil-Hoch-Taste
#EventID_SRight = 106                   ; Ereignis-Kennung für die Umschalt + Pfeil-Rechts-Taste
#EventID_SDown = 107                    ; Ereignis-Kennung für die Umschalt + Pfeil-Runter-Taste
#ScrollbarSize = 20                     ; Breite/Höhe der Scrollbars
#DefGridWidth = 72                      ; Standard-Zellenbreite
#DefGridHeight = 22                     ; Standard-Zellenhöhe
#DefColor_Grid = $BBBBBB                ; Standardfarbe für das Gitternetz
#DefColor_Backgr = $999999              ; Standardfarbe für den Hintergrund
#DefColor_CellBack = $FFFFFF            ; Standardfarbe für den Zellenhintergrund
#DefColor_CaptBack = $BBFFFF            ; Standardfarbe für den Überschrift/Beschriftungs-Hintergrund
#DefColor_CaptFocus = $A0FFFF           ; Standardfarbe für den Überschrift/Beschriftungs-Hintergrund, bei Fokus-Erhalt einer enthaltenen Zelle
#DefColor_CellLoFoc = $DFDF80           ; Standardfarbe für den Zellhintergrund bei Fokus-Erhalt und Sperr-Zustand -1
#DefColor_CellFore = $000000            ; Standardfarbe für den Zelleninhalt (Text)
#DefColor_CellFocus = $FFFF00           ; Standardfarbe für den Zellenhintergrund bei Fokus-Erhalt
#DefColor_CellLock = $E0E0E0            ; Standardfarbe für den Zellenhintergrund, wenn Zelle gesperrt ist
#DefColor_CellFocusInact = $FFFFDD      ; Standardfarbe für den Zellhintergrund der aktiven Zelle, wenn Grid nicht fokusiert ist
#DefColor_ColSumSymbol = $AADDDD        ; Standardfarbe für das Spalten-Summen-Zeichen
#DefColor_Symbols = $AADDDD             ; Standardfarbe für das Spalten-Sortierungs-Zeichen
#DefGridVisible = 1                     ; Standardmäßig werden Gitternetz-Linien angezeigt
#DefColCaptVisible = -1                 ; Standardmäßig werden Spaltenüberschriften nicht mit angezeigt
#DefRowCaptVisible = -1                 ; Standardmäßig werden Zeilenüberschriften nicht mit angezeigt
#DefColCaptWidth = 50                   ; Standardmäßige Spaltenbreite für die Zeilenüberschrift
; **************************************************************
;- Strukturen
; **************************************************************
Structure CSGrid_Type
  GadgetID.l                    ; Long    => Gadget-ID des Container-Objektes
  hWnd.l                        ; Long    => Handle des Container-Objektes
  hImage.l                      ; Long    => Handle für das Image
  hImageGadget.l                ; Long    => Handle für das Image-Gadget-Objekt
  hHscrollGadget.l              ; Long    => Handle für das horizontale Scroll-Gadget-Objekt
  hVscrollGadget.l              ; Long    => Handle für das vertikale Scroll-Gadget-Objekt
  hInputText.l                  ; Long    => Handle für das Eingabefeld "Text"
  hInputRollup.l                ; Long    => Handle für das Eingabefeld "Rollup/Pulldown"
  Left.l                        ; Word    => X-Position des Grid-Objektes
  Top.l                         ; Word    => Y-Position des Grid-Objektes
  Width.l                       ; Word    => Breite des Grid-Objektes
  Height.l                      ; Word    => Höhe des Grid-Objektes
  DefGridWidth.l                ; Word    => Standard-Spaltenbreite
  DefGridHeight.l               ; Word    => Standard-Spaltenhöhe
  ImgWidth.l                    ; Word    => Breite des Zeichenbereiches
  ImgHeight.l                   ; Word    => Höhe des Zeichenbereiches
  Cols.l                        ; Byte    => Anzahl der Spalten (+ 128 = 0 bis 255)
  Rows.l                        ; Word    => Anzahl der Zeilen (+32768 = 0 bis 65535)
  ScrollX.l                     ; Byte    => Scrollposition in der Spalte
  ScrollY.l                     ; Word    => Scrollposition in der Zeile
  ActColStart.l                 ; Byte    => Aktuelle Spalte (des Cursors, Startpos bei Bereich)
  ActRowStart.l                 ; Word    => Aktuelle Zeile (des Cursors, Startpos bei Bereich)
  ActColEnd.l                   ; Byte    => Aktuelle Spalte (des Cursors, Endpos bei Bereich)
  ActRowEnd.l                   ; Word    => Aktuelle Zeile (des Cursors, Endpos bei Bereich)
  ActXStart.l                   ; Word    => X-Position der aktuellen Zelle (bei Bereich Startpos)
  ActYStart.l                   ; Word    => Y-Position der aktuellen Zelle (bei Bereich Startpos)
  ActXEnd.l                     ; Word    => X-Position der aktuellen Zelle (bei Bereich Endpos)
  ActYEnd.l                     ; Word    => Y-Position der aktuellen Zelle (bei Bereich Endpos)
  LastVisCol.l                  ; Byte    => Letzte angezeigte Spalte
  LastVisRow.l                  ; Byte    => Letzte angezeigte Zeile
  Cells.l                       ; Long    => Anzahl der Zellen 
  Font.l                        ; Long    => Handle für Schriftart
  GridVisible.l                 ; Byte    => Anzeige des Gitters (1=angezeigt, -1=unsichtbar)
  ColCaptVisible.l              ; Byte    => Anzeige der Spaltenüberschrift (1=angezeigt, -1=unsichtbar)
  RowCaptVisible.l              ; Byte    => Anzeige der Zeilenüberschrift (1=angezeigt, -1=unsichtbar)
  RowCaptWidth.l                ; Byte    => Spaltenbreite der Zeilenüberschrift
  ColCustWidth.l                ; Byte    => Benutzerspezifische Spaltenbreiten-Anpassung (1=kann verändert werden, -1=fix)
  Color_Backgr.l                ; Long    => Hintergrundfarbe des Bereiches hinter den Zellen
  Color_Grid.l                  ; Long    => Farbe des Gitters
  Color_CellBack.l              ; Long    => Hintergrundfarbe in der Zelle
  Color_CellFore.l              ; Long    => Vordergrundfarbe in der Zelle
  Color_CaptBack.l              ; Long    => Hintergrundfarbe für die Überschrift/Beschriftung
  Color_CellFocus.l             ; Long    => Hintergrundfarbe der Zelle, bei Fokus-Erhalt
  Color_CaptFocus.l             ; Long    => Hintergrundfarbe der Überschrift/Beschriftung, bei Fokus-Erhalt einer enthaltenen Zelle
  Color_CellLock.l              ; Long    => Hintergrundfarbe der Zelle, wenn Zelle gesperrt ist
  Color_CellLoFoc.l             ; Long    => Hintergrundfarbe der Zelle, bei Fokus-Erhalt mit dem Sperr-Zustand -1
  Color_CellFocusInact.l        ; Long    => Hintergrundfarbe der aktuellen Zelle, wenn Grid nicht fokusiert ist
  InputMode.l                   ; Byte    => Eingabemodus 0=keine Eingabe, 1=Text, 16=Rollup 
  AutoRedraw.l                  ; Byte    => Automatische Darstellungsaktualisierung aktivieren (1=auto, -1=manual)
  CellMatrixStartID.l           ; Long    => Start-Nummer in der Liste der Zellen-Info, mit der die Zellen des jeweiligen Grids beginnen (+Zellenanzahl=End-Pos)
  ShowColSummary.l              ; Byte    => Anzeigen der Spalten-Summe
  AutoSort.l                    ; Byte    => Automatische Sortierung, wenn Sortierung vorgegeben bei neuer Zeile oder Inhaltsänderung in Sortierspalte
  SortCol.l                     ; Byte    => Spalte nach der aktuell sortiert wurde
  SortDir.l                     ; Byte    => Sortier-Richtung mit der aktuell sortiert wurde
  UserSort.l                    ; Byte    => Benutzerspezifische Sortierung (1=kann mit Doppelklick sortiert werden, -1=fix)
  GridLock.l                    ; Byte    => Sperrzustand der gesamten Tabelle, -1=nicht editierbar,-16=nicht auswählbar, 1 und 16 ist das gleiche, nur nicht grau hinterlegte Zellen
  ScrollBarHVis.l               ; Byte    => Sichtbarkeit des horizontalen Scrollbalken, -1=nicht sichtbar, 1=sichtbar
  ScrollBarVVis.l               ; Byte    => Sichtbarkeit des vertikalen Scrollbalken, -1=nicht sichtbar, 1=sichtbar
  RowExpand.l                   ; Byte    => Zeilen-Details zulassen, -1=nicht zugelassen, 1=zugelassen
  CommaSep.l                    ; Byte    => ASCII-Code für Komma-Separator
EndStructure
Structure CSGrid_TypeCell
  content.s                     ; String  => Inhalt der Zelle
  lock.l                        ; Byte    => Sperr-Status der Zelle, -1=nicht editierbar,-16=nicht auswählbar,0=Standard
  ;color_back.l                  ; Long    => Hintergrundfarbe der Zelle
EndStructure
Structure CSGrid_TypeCol
  hWnd.l                        ; Long    => Handle des Grids
  col.l                         ; Byte    => Nummer der Spalte
  width.l                       ; Word    => Breite der Spalte
  caption.s                     ; String  => Spaltenbeschriftung
  datatype.l                    ; Byte    => Datentyp der Zellen der Spalte, 0=Text, 1=Ganzzahl, 2=Boolean, 16=Fließkomma, 17=Fließkomma (2 Stellen), 32=EUR, 33=USD, 64=Prozent, 127=benutzerdefiniertes Ausgabeformat
  userNumberFormat.s            ; String  => Benutzerdefiniertes Zahlenausgabeformat
  summary.l                     ; Byte    => Spaltensumme wird erzeugt
  sumval.f                      ; Float   => Wert der Spaltensumme
  inputType.l                   ; Byte    => Eingabetyp 0=freie Texteingabe, 16=Rollup mit Wertliste, 17=Rollup mit Wertliste 2-spaltig, 32=Rollup mit SQL-String, 33=Rollup mit SQL-String 2-spaltig (Boolean-Datentyp setzt Eingabeformat automatisch)
  inputRessource.s              ; String  => Eingabe-Ressource (Eingabeformat, Werteliste, SQL-String) in Kombination mit inputType ausgewertet
  ;color_back.l                  ; Long    => Hintergrundfarbe der kompletten Spalte
EndStructure
Structure CSGrid_TypeRow
  hWnd.l                        ; Long    => Handle des Grids
  row.l                         ; Word    => Nummer der Zeile
  caption.s                     ; String  => Zeilenbeschriftung
  hDetails.l                    ; Long    => Handle des Zeilen-Details-Objektes (kann auch ein CSGridGadget sein)
  DetailsHeight.l               ; Word    => Höhe des Zeilen-Details-Objektes
  DetailsVisible.l              ; Byte    => Status des Zeilen-Details (-1=nicht angezeigt, 1=angezeigt)
  ;color_back.l                  ; Long    => Hintergrundfarbe der kompletten Zeile
EndStructure
; **************************************************************
;- Variablen
; **************************************************************
Global CSGrid_ActGridhWnd.l    ; Long    => Handle des aktuellen, fokusierten Grid-Controls
NewList CSGrid.CSGrid_Type()
NewList CSGrid_Cell.CSGrid_TypeCell()
NewList CSGrid_Col.CSGrid_TypeCol()
NewList CSGrid_Row.CSGrid_TypeRow()
; **************************************************************
;- Deklaration von Funktionen und Hilfsfunktionen
; **************************************************************
; Öffentliche Funktionen:
Declare CSGridGadget(Gadget.l,x.l,y.l,width.l,height.l,cols.l,rows.l)                  ; PUBLIC-Funktion für das Erzeugen eines Grid-Gadgets
Declare.l CSGridGadget_GetActualGrid()                                                 ; PUBLIC-Funktion zum Ermitteln des aktuellen Grids
Declare CSGridGadget_SetAutoRedraw(Gadget.l,Enabled.l)                                 ; PUBLIC-Funktion zum Setzen der autom. Zeichnung bei Änderung
Declare.l CSGridGadget_GetAutoRedraw(Gadget.l)                                         ; PUBLIC-Funktion zum Ermitteln der autom. Zeichnung bei Änderung
Declare CSGridGadget_SetAutoSort(Gadget.l,Enabled.l)                                   ; PUBLIC-Funktion zur Aktivierung der automatischen Sortierung
Declare.l CSGridGadget_GetAutoSort(Gadget.l)                                           ; PUBLIC-Funktion zum Ermitteln der Aktivierung der automatischen Sortierung
Declare CSGridGadget_SetGridLockStatus(Gadget.l,Status.l)                              ; PUBLIC-Funktion zum Setzen des Sperr-Status der gesamten Tabelle
Declare.l CSGridGadget_GetGridLockStatus(Gadget.l)                                     ; PUBLIC-Funktion zum Ermitteln des Sperr-Status der gesamten Tabelle
Declare CSGridGadget_SetColDataType(Gadget.l,Col.l,DataType.l)                         ; PUBLIC-Funktion zum Setzen des Datentyps einer Spalte
Declare.l CSGridGadget_GetColDataType(Gadget.l,Col.l)                                  ; PUBLIC-Funktion zum Ermitteln des Datentyps einer Spalte
Declare CSGridGadget_SetColUserNumberFormat(Gadget.l,Col.l,UserNumberFormat.s)         ; PUBLIC-Funktion zum Setzen des Zahlen-Ausgabeformates für eine Spalte
Declare.s CSGridGadget_GetColUserNumberFormat(Gadget.l,Col.l)                          ; PUBLIC-Funktion zum Ermitteln des Zahlen-Ausgabeformates einer Spalte
Declare CSGridGadget_SetColSummary(Gadget.l,Col.l,Enabled.l)                           ; PUBLIC-Funktion zum Setzen der Spalten-Summen-Eigenschaft
Declare.l CSGridGadget_GetColSummary(Gadget.l,Col.l)                                   ; PUBLIC-Funktion zum Ermitteln der Spalten-Summen-Eigenschaft
;Declare.f CSGridGadget_GetColSummaryValue(Gadget.l,Col.l)                              ; PUBLIC-Funktion zum Ermitteln der Spalten-Summe (sofern Summierung aktiviert wurde)
Declare CSGridGadget_SetColWidth(Gadget.l,Col.l,Width.l)                               ; PUBLIC-Funktion zum Setzen einer Spaltenbreite
Declare.l CSGridGadget_GetColWidth(Gadget.l,Col.l)                                     ; PUBLIC-Funktion zum Ermitteln der Spaltenbreite
Declare CSGridGadget_SetColCaption(Gadget.l,Col.l,Caption.s)                           ; PUBLIC-Funktion zum Setzen einer Spaltenbeschriftung
Declare.s CSGridGadget_GetColCaption(Gadget.l,Col.l)                                   ; PUBLIC-Funktion zum Ermitteln einer Spaltenbeschriftung
Declare CSGridGadget_SetRowCaption(Gadget.l,Row.l,Caption.s)                           ; PUBLIC-Funktion zum Setzen einer Zeilenbeschriftung
Declare.s CSGridGadget_GetRowCaption(Gadget.l,Row.l)                                   ; PUBLIC-Funktion zum Ermitteln einer Zeilenbeschriftung
Declare CSGridGadget_SetRowsHeight(Gadget.l,Height.l)                                  ; PUBLIC-Funktion zum Setzen der Zellen/Zeilen-Höhe
Declare.l CSGridGadget_GetRowsHeight(Gadget.l)                                         ; PUBLIC-Funktion zum Ermitteln der Zellen/Zeilen-Höhe
Declare CSGridGadget_SetRowDetailsEnabled(Gadget.l,Enabled.l)                          ; PUBLIC-Funktion zum Setzen der Spalten-Summen-Eigenschaft
Declare.l CSGridGadget_GetRowDetailsEnabled(Gadget.l)                                  ; PUBLIC-Funktion zum Ermitteln der Spalten-Summen-Eigenschaft
Declare CSGridGadget_SetRowDetailsHandle(Gadget.l,Row.l,handle.l,height.l)             ; PUBLIC-Funktion zum Setzen eines Zeilen-Details-Objektes
Declare.l CSGridGadget_GetRowDetailsHandle(Gadget.l,Row.l)                             ; PUBLIC-Funktion zum Ermitteln einer Zeilenbeschriftung
Declare CSGridGadget_SetCellValue(Gadget.l,Col.l,Row.l,Value.s)                        ; PUBLIC-Funktion zum Setzen des Zell-Inhalts
Declare.s CSGridGadget_GetCellValue(Gadget.l,Col.l,Row.l)                              ; PUBLIC-Funktion zum Ermitteln eines Zellen-Inhalts
Declare CSGridGadget_SetCellLockStatus(Gadget.l,Col.l,Row.l,Status.l)                  ; PUBLIC-Funktion zum Setzen des Sperr-Zustandes einer Zelle
Declare.l CSGridGadget_GetCellLockStatus(Gadget.l,Col.l,Row.l)                         ; PUBLIC-Funktion zum Ermitteln des Sperr-Zustandes einer Zelle
Declare CSGridGadget_SetGridLinesVisibility(Gadget.l,Visible.l)                        ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Gitternetzlinien
Declare.l CSGridGadget_GetGridLinesVisibility(Gadget.l)                                ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Gitternetzlinien
Declare CSGridGadget_SetColCaptionVisibility(Gadget.l,Visible.l)                       ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Spaltenköpfen
Declare.l CSGridGadget_GetColCaptionVisibility(Gadget.l)                               ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Spaltenköpfen
Declare CSGridGadget_SetRowCaptionVisibility(Gadget.l,Visible.l)                       ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Zeilenköpfen
Declare.l CSGridGadget_GetRowCaptionVisibility(Gadget.l)                               ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Zeilenköpfen
Declare CSGridGadget_SetColsScaleable(Gadget.l,Enabled.l)                              ; PUBLIC-Funktion zum Setzen der Abänderbarkeit von Spaltenbreiten
Declare.l CSGridGadget_GetColsScaleable(Gadget.l)                                      ; PUBLIC-Funktion zum Ermitteln der Abänderbarkeit von Spaltenbreiten
Declare CSGridGadget_SetColsUserSort(Gadget.l,Enabled.l)                               ; PUBLIC-Funktion zum Setzen der Abänderbarkeit von Spaltensortierungen
Declare.l CSGridGadget_GetColsUserSort(Gadget.l)                                       ; PUBLIC-Funktion zum Ermitteln der Abänderbarkeit von Spaltensortierungen
Declare CSGridGadget_SetColorBackground(Gadget.l,Color.l)                              ; PUBLIC-Funktion zum Setzen der Hintergrundfarbe
Declare.l CSGridGadget_GetColorBackground(Gadget.l)                                    ; PUBLIC-Funktion zum Ermitteln der Hintergrundfarbe
Declare CSGridGadget_SetColorGrid(Gadget.l,Color.l)                                    ; PUBLIC-Funktion zum Setzen der Farbe der Gitternetzlinien
Declare.l CSGridGadget_GetColorGrid(Gadget.l)                                          ; PUBLIC-Funktion zum Ermitteln der Farbe der Gitternetzlinien
Declare CSGridGadget_SetColorCellBackDef(Gadget.l,Color.l)                             ; PUBLIC-Funktion zum Setzen der Standard Hintergrundfarbe der Zellen
Declare.l CSGridGadget_GetColorCellBackDef(Gadget.l)                                   ; PUBLIC-Funktion zum Ermitteln der Standard Hintergrundfarbe der Zellen
Declare CSGridGadget_SetColorCellTextDef(Gadget.l,Color.l)                             ; PUBLIC-Funktion zum Setzen der Standard Schrift-Farbe der Zellen
Declare.l CSGridGadget_GetColorCellTextDef(Gadget.l)                                   ; PUBLIC-Funktion zum Ermitteln der Standard Schrift-Farbe der Zellen
Declare CSGridGadget_SetColorColRowCapt(Gadget.l,Color.l)                              ; PUBLIC-Funktion zum Setzen der Farbe für die Spalten-/Zeilen-Überschriften
Declare.l CSGridGadget_GetColorColRowCapt(Gadget.l)                                    ; PUBLIC-Funktion zum Ermitteln der Farbe für die Spalten-/Zeilen-Überschriften
Declare CSGridGadget_SetColorCellBackFocus(Gadget.l,Color.l)                           ; PUBLIC-Funktion zum Setzen der Farbe für fokusierte Zellen
Declare.l CSGridGadget_GetColorCellBackFocus(Gadget.l)                                 ; PUBLIC-Funktion zum Ermitteln der Farbe für fokusierte Zellen
Declare CSGridGadget_SetColorColRowCaptFocus(Gadget.l,Color.l)                         ; PUBLIC-Funktion zum Setzen der Farbe für Spalten-/Zeilen-Überschriften von fokusierte Zellen
Declare.l CSGridGadget_GetColorColRowCaptFocus(Gadget.l)                               ; PUBLIC-Funktion zum Ermitteln der Farbe für Spalten-/Zeilen-Überschriften von fokusierte Zellen
Declare CSGridGadget_SetColorCellBackLock(Gadget.l,Color.l)                            ; PUBLIC-Funktion zum Setzen der Farbe für eine gesperrte Zelle
Declare.l CSGridGadget_GetColorCellBackLock(Gadget.l)                                  ; PUBLIC-Funktion zum Ermitteln der Farbe für eine gesperrte Zelle
Declare CSGridGadget_SetColorCellBackLockFocus(Gadget.l,Color.l)                       ; PUBLIC-Funktion zum Setzen der Farbe für eine gesperrte, fokusierte Zelle
Declare.l CSGridGadget_GetColorCellBackLockFocus(Gadget.l)                             ; PUBLIC-Funktion zum Ermitteln der Farbe für eine gesperrte, fokusierte Zelle
Declare CSGridGadget_SetColorCellBackFocusInactive(Gadget.l,Color.l)                   ; PUBLIC-Funktion zum Setzen der Farbe für eine fokusierte Zelle eines inaktiven Gadgets
Declare.l CSGridGadget_GetColorCellBackFocusInactive(Gadget.l)                         ; PUBLIC-Funktion zum Ermitteln der Farbe für eine fokusierte Zelle eines inaktiven Gadgets
Declare CSGridGadget_SetFormatComma(Gadget.l,Char.s)                                   ; PUBLIC-Funktion zum Definieren des Komma-Zeichens für die formatierte Zahlenausgabe
Declare.s CSGridGadget_GetFormatComma(Gadget.l)                                        ; PUBLIC-Funktion zum Ermitteln des Komma-Zeichens für die formatierte Zahlenausgabe
Declare.l CSGridGadget_GetRowsCount(Gadget.l)                                          ; PUBLIC-Funktion zum Ermitteln der Zeilenanzahl
Declare.l CSGridGadget_GetColsCount(Gadget.l)                                          ; PUBLIC-Funktion zum Ermitteln der Spaltenanzahl
Declare CSGridGadget_SetActualCellValue(Gadget.l,Value.s)                              ; PUBLIC-Funktion zum Setzen des Inhaltes der aktuellen Zelle
Declare.s CSGridGadget_GetActualCellValue(Gadget.l)                                    ; PUBLIC-Funktion zum Ermitteln des Inhaltes der aktuellen Zelle
Declare CSGridGadget_SetActualCellState(Gadget.l,State.l)                              ; PUBLIC-Funktion zum Setzen des Status der aktuellen Zelle
Declare.l CSGridGadget_GetActualCellState(Gadget.l)                                    ; PUBLIC-Funktion zum Ermitteln des Status der aktuellen Zelle
Declare CSGridGadget_SetFont(Gadget.l,Font.l)                                          ; PUBLIC-Funktion zum Setzen der Schriftart
Declare.l CSGridGadget_GetFont(Gadget.l)                                               ; PUBLIC-Funktion zum Ermitteln der Schriftart
Declare.l CSGridGadget_GetActualRow(Gadget.l)                                          ; PUBLIC-Funktion zum Ermitteln der aktuellen Zeilen-Position des Cursors
Declare.l CSGridGadget_GetActualCol(Gadget.l)                                          ; PUBLIC-Funktion zum Ermitteln der aktuellen Spalten-Position des Cursors
Declare CSGridGadget_SetCursor(Gadget.l,Col.l,Row.l,)                                  ; PUBLIC-Funktion zum Setzen des Cursors
Declare CSGridGadget_SetCursorRange(Gadget.l,StartCol.l,StartRow.l,EndCol.l,EndRow.l)  ; PUBLIC-Funktion zum Setzen eines Markierungsbereichs
Declare CSGridGadget_CopySelectionToClipboard(Gadget.l)                                ; PUBLIC-Funktion zum Kopieren der aktuellen Markierung in die Zwischenablage
Declare CSGridGadget_AddRow(Gadget.l,Position.l)                                       ; PUBLIC-Funktion zum Hinzufügen einer Zeile zu einem CS-Grid-Gadget
Declare CSGridGadget_AddRowWithContent(Gadget.l,Position.l,Text$,ImageID.l)            ; PUBLIC-Funktion zum Hinzufügen einer Zeile mit Inhalt (Spalten mit Tab [ASC10] getrennt) zu einem CS-Grid-Gadget
Declare CSGridGadget_RemoveRow(Gadget.l,Position.l)                                    ; PUBLIC-Funktion zum Enternen einer Zeile
Declare CSGridGadget_AddCol(Gadget.l,Position.l)                                       ; PUBLIC-Funktion zum Hinzufügen einer Spalte zu einem CS-Grid-Gadget
Declare CSGridGadget_AddColWithContent(Gadget.l,Position.l,Content.s,ImageID.l)        ; PUBLIC-Funktion zum Hinzufügen einer Spalte mit Inhalt (Spalten mit Tab [ASC10] getrennt) zu einem CS-Grid-Gadget
Declare CSGridGadget_RemoveCol(Gadget.l,Position.l)                                    ; PUBLIC-Funktion zum Entfernen einer Spalte 
Declare CSGridGadget_RemoveAllCells(Gadget.l)                                          ; PUBLIC-Funktion zum Entfernen sämtlicher Zeilen
Declare CSGridGadget_ColSort(Gadget.l,Col.l,Direction.l)                               ; PUBLIC-Funktion zum Sortieren einer Tabelle nach einer bestimmten Spalte
Declare.l CSGridGadget_EventHandling(eventID)                                          ; PUBLIC-Funktion zum Verarbeiten eines Purebasic-Events
Declare CSGridGadget_SetFocus(Gadget.l)                                                ; PUBLIC-Funktion zum Setzen des Fokus eines CS-Grid-Gadgets
Declare CSGridGadget_Resize(Gadget.l,x.l,y.l,width.l,height.l)                         ; PUBLIC-Funktion zum Positionieren und Skalieren eines CS-Grid-Objektes
Declare CSGridGadget_Redraw(Gadget.l)                                                  ; PUBLIC-Funktion zum manuellen Neuzeichnen eines Grid-Objektes
Declare CSGridGadget_FreeGadget(Gadget.l)                                              ; PUBLIC-Funktion zum Entfernen eines CS-Grid-Objektes
IncludeFile "CS-Grid2-1H.pb"
; *************************************************************
;- Oeffentliche Funktionen
; *************************************************************
Procedure CSGridGadget(Gadget.l,x.l,y.l,width.l,height.l,cols.l,rows.l) ; Creates a CS-Grid Gadget
  ; PUBLIC-Funktion für das Erzeugen eines Grid-Gadgets
  Protected n.l
  H_InitShortCuts()
  AddElement(CSGrid())
  ;Debug CountList(CSGrid())
  ;CSGrid()\Font = CSGrid_Font.l
  CSGrid()\DefGridWidth = #DefGridWidth                       ; Standard-Zellenbreite
  CSGrid()\DefGridHeight = #DefGridHeight                     ; Standard-Zellenhöhe
  CSGrid()\Color_Grid = #DefColor_Grid                        ; Standardfarbe für das Gitternetz
  CSGrid()\Color_Backgr = #DefColor_Backgr                    ; Standardfarbe für den Hintergrund
  CSGrid()\Color_CellBack = #DefColor_CellBack                ; Standardfarbe für den Zellenhintergrund
  CSGrid()\Color_CaptBack = #DefColor_CaptBack                ; Standardfarbe für den Überschrift/Beschriftungs-Hintergrund
  CSGrid()\Color_CaptFocus = #DefColor_CaptFocus              ; Standardfarbe für den Überschrift/Beschriftungs-Hintergrund, bei Fokus-Erhalt einer enthaltenen Zelle
  CSGrid()\Color_CellLoFoc = #DefColor_CellLoFoc              ; Standardfarbe für den Zellhintergrund bei Fokus-Erhalt und Sperr-Zustand -1
  CSGrid()\Color_CellFore = #DefColor_CellFore                ; Standardfarbe für den Zelleninhalt (Text)
  CSGrid()\Color_CellFocus = #DefColor_CellFocus              ; Standardfarbe für den Zellenhintergrund bei Fokus-Erhalt
  CSGrid()\Color_CellLock = #DefColor_CellLock                ; Standardfarbe für den Zellenhintergrund, wenn Zelle gesperrt ist
  CSGrid()\Color_CellFocusInact = #DefColor_CellFocusInact    ; Standardfarbe für den Zellenhintergrund der aktiven Zelle, wenn Grid nicht fokusiert ist
  CSGrid()\GridVisible = #DefGridVisible                      ; Standardmäßig werden Gitternetz-Linien angezeigt
  CSGrid()\ColCaptVisible = #DefColCaptVisible                ; Standardmäßig werden Spaltenüberschriften mit angezeigt
  CSGrid()\RowCaptVisible = #DefRowCaptVisible                ; Standardmäßig werden Zeilenüberschriften mit angezeigt
  CSGrid()\RowCaptWidth = #DefColCaptWidth                    ; Standardmäßige Spaltenbreite für die Zeilenüberschrift    
  CSGrid()\AutoRedraw = 1
  CSGrid()\AutoSort = -1
  CSGrid()\SortCol = -1
  CSGrid()\UserSort = -1
  CSGrid()\Left = x.l
  CSGrid()\Top = y.l
  CSGrid()\Width = width.l
  CSGrid()\Height = height.l
  CSGrid()\Cols = cols.l
  CSGrid()\Rows = rows.l
  CSGrid()\Cells = CSGrid()\Cols * CSGrid()\Rows
  CSGrid()\CellMatrixStartID = CountList(CSGrid_Cell())
  LastElement(CSGrid_Cell())
  For n = 1 To CSGrid()\Cells
    AddElement(CSGrid_Cell())
  Next
  CSGrid()\ImgWidth = CSGrid()\Width-#ScrollbarSize-3
  CSGrid()\ImgHeight = CSGrid()\Height-#ScrollbarSize-3
  CSGrid()\hImage = CreateImage(#PB_Any, CSGrid()\ImgWidth,CSGrid()\ImgHeight)
  CSGrid()\hWnd = ContainerGadget(Gadget,CSGrid()\Left,CSGrid()\Top,CSGrid()\Width,CSGrid()\Height,CSGrid()\hImage)
  If Gadget <> #PB_Any
    CSGrid()\GadgetID = Gadget
    ;CSGrid()\hWnd = IsGadget(CSGrid()\hWnd)
    CSGrid()\hWnd = GadgetID(CSGrid()\GadgetID)
  EndIf
    CSGrid()\hImageGadget = ImageGadget(#PB_Any,0,0,CSGrid()\ImgWidth,CSGrid()\ImgHeight,CSGrid()\hImage)
    CSGrid()\hVscrollGadget = ScrollBarGadget(#PB_Any,CSGrid()\Width-#ScrollbarSize-3,0,#ScrollbarSize,CSGrid()\Height-#ScrollbarSize,0,CSGrid()\Rows,1,#PB_ScrollBar_Vertical)
    CSGrid()\hHscrollGadget = ScrollBarGadget(#PB_Any,0,CSGrid()\Height-#ScrollbarSize-3,CSGrid()\Width-#ScrollbarSize,#ScrollbarSize,0,CSGrid()\Cols,1)
  CloseGadgetList()
  H_DrawGrid(-1)
  H_DrawScrollbars(1)  
  ProcedureReturn CSGrid()\hWnd
EndProcedure
Procedure.l CSGridGadget_GetActualGrid() ; Returns the hWnd of the actual / focused CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des aktuellen Grids
  ProcedureReturn CSGrid_ActGridhWnd
EndProcedure
Procedure CSGridGadget_Redraw(Gadget.l) ; Redraws a CS-Grid-Gadget
  ; PUBLIC-Funktion zum manuellen Neuzeichnen eines Grid-Objektes
  If H_GetGadget(Gadget.l) = 1
    H_DrawGrid(1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetActualRow(Gadget.l) ; Returns the ID of cursor's row position of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der aktuellen Zeilen-Position des Cursors
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\ActRowEnd
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetActualCol(Gadget.l) ; Returns the ID of cursor's col position of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der aktuellen Spalten-Position des Cursors
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\ActColEnd
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetRowsCount(Gadget.l) ; Returns the count of Rows of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Zeilenanzahl
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Rows
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColsCount(Gadget.l) ; Returns the count of Cols of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Spaltenanzahl
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Cols
  EndIf
EndProcedure
Procedure.s CSGridGadget_GetActualCellValue(Gadget.l) ; Returns the content of the actual cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Inhaltes der aktuellen Zelle
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn H_GetCellValue(CSGrid()\ActColEnd,CSGrid()\ActRowEnd)
  EndIf
EndProcedure
Procedure CSGridGadget_SetActualCellValue(Gadget.l,Value.s) ; Sets the content of the actual cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Inhaltes der aktuellen Zelle
  If H_GetGadget(Gadget.l) = 1
    CSGridGadget_SetCellValue(Gadget.l,CSGrid()\ActColEnd,CSGrid()\ActRowEnd,Value.s)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetActualCellState(Gadget.l) ; Returns the state of the actual cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Status der aktuellen Zelle
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn H_GetCellLockStatus(CSGrid()\ActColEnd,CSGrid()\ActRowEnd)
  EndIf
EndProcedure
Procedure CSGridGadget_SetActualCellState(Gadget.l,State.l) ; Sets the state of the actual cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Status der aktuellen Zelle
  If H_GetGadget(Gadget.l) = 1
    CSGridGadget_SetCellLockStatus(Gadget.l,CSGrid()\ActColEnd,CSGrid()\ActRowEnd,State.l)
  EndIf
EndProcedure
Procedure CSGridGadget_SetColDataType(Gadget.l,Col.l,DataType.l) ; Sets the datatype for a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Datentyps einer Spalte
  ; Datentyp der Zellen der Spalte, 0=Text, 1=Ganzzahl, 2=Boolean, 16=Fließkomma, 17=Fließkomma (2 Stellen), 32=EUR, 33=USD, 64=Prozent, 127=benutzerdefiniertes Ausgabeformat
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      H_SetColDataType(Gadget.l,Col.l,DataType.l)
    EndIf    
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColDataType(Gadget.l,Col.l) ; Returns the datatype of a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Datentyps einer Spalte
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetColDataType(Col.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetColUserNumberFormat(Gadget.l,Col.l,UserNumberFormat.s) ; Sets the user numberformat for a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Zahlen-Ausgabeformates für eine Spalte
  ; Datentyp der Zellen der Spalte, 0=Text, 1=Ganzzahl, 2=Boolean, 16=Fließkomma, 17=Fließkomma (2 Stellen), 32=EUR, 33=USD, 64=Prozent, 127=benutzerdefiniertes Ausgabeformat
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      H_SetColUserNumberFormat(Gadget.l,Col.l,UserNumberFormat.s)
    EndIf    
  EndIf
EndProcedure
Procedure.s CSGridGadget_GetColUserNumberFormat(Gadget.l,Col.l) ; Returns the user numberformat string of a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Zahlen-Ausgabeformates einer Spalte
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetColUserNumberFormat(Col.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetColSummary(Gadget.l,Col.l,Enabled.l) ; Sets the summary-flag for a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Spalten-Summen-Eigenschaft
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      H_SetColSummaryFlag(Gadget.l,Col.l,Enabled.l)
    EndIf    
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColSummary(Gadget.l,Col.l) ; Returns the value of the summary-flag of a column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Spalten-Summen-Eigenschaft
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetColSummaryFlag(Col.l)
    EndIf
  EndIf
EndProcedure
Procedure.f CSGridGadget_GetColSummaryValue(Gadget.l,Col.l) ; Returns the value/sum of a summarized column of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Spalten-Summe (sofern Summierung aktiviert wurde)
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      If H_GetColSummaryFlag(Col.l) = 1      
        ProcedureReturn CSGrid_Col()\sumval
      Else
        ProcedureReturn 0.0
      EndIf
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetRowDetailsEnabled(Gadget.l,Enabled.l) ; Enables showing row details (if available) of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Spalten-Summen-Eigenschaft
  If H_GetGadget(Gadget.l) = 1
    If CSGrid()\hWnd <> 0
      CSGrid()\RowExpand = Enabled.l
    EndIf    
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetRowDetailsEnabled(Gadget.l) ; Returns the value of the row-details-flag of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Spalten-Summen-Eigenschaft
  If H_GetGadget(Gadget.l) = 1
    If CSGrid()\hWnd <> 0
      ProcedureReturn CSGrid()\RowExpand
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetGridLockStatus(Gadget.l,Status.l) ; Sets the lock-status of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Sperr-Status der gesamten Tabelle
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\GridLock = Status.l
    If Status.l <= -16 Or Status.l >= 16
      CSGrid()\ActColStart = -1 
      CSGrid()\ActRowStart = -1
      CSGrid()\ActColEnd = -1 
      CSGrid()\ActRowEnd = -1
    EndIf
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetGridLockStatus(Gadget.l) ; Returns the lock-status of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Sperr-Status der gesamten Tabelle
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\GridLock
  EndIf
EndProcedure
Procedure CSGridGadget_SetRowsHeight(Gadget.l,Height.l) ; Sets the row/cell's height of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Zellen/Zeilen-Höhe
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\DefGridHeight = Height.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetRowsHeight(Gadget.l) ; Returns the row/cell's height of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Zellen/Zeilen-Höhe
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\DefGridHeight
  EndIf
EndProcedure
Procedure CSGridGadget_SetColWidth(Gadget.l,Col.l,Width.l) ; Sets a Column-Width of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen einer Spaltenbreite
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      H_SetColWidth(Gadget.l,Col.l,Width.l)
    EndIf
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColWidth(Gadget.l,Col.l) ; Returns a Column-Width of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Spaltenbreite
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetColWidth(Col.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetColCaption(Gadget.l,Col.l,Caption.s) ; Sets a Column-Caption of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen einer Spaltenbeschriftung
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      If H_CheckIfColSetExists(Col.l) < 1
        LastElement(CSGrid_Col())
        AddElement(CSGrid_Col())
        CSGrid_Col()\hWnd = Gadget.l
        CSGrid_Col()\col = Col.l
      EndIf
      CSGrid_Col()\caption = Caption.s
      H_DrawGrid(-1)
    EndIf
  EndIf
EndProcedure
Procedure.s CSGridGadget_GetColCaption(Gadget.l,Col.l) ; Returns a Column-Caption of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln einer Spaltenbeschriftung
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetColCaption(Col.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_ColSort(Gadget.l,Col.l,Direction.l) ; Sorts a CS-Grid-Gadget according to a Column
  ; PUBLIC-Funktion zum Sortieren einer Tabelle nach einer bestimmten Spalte
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0 And (Direction.l = 1 Or Direction.l = -1)
      H_DoColSorting(Col.l,Direction.l)
      H_DrawGrid(-1)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetRowCaption(Gadget.l,Row.l,Caption.s) ; Sets a Row-Caption of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen einer Zeilenbeschriftung
  If H_GetGadget(Gadget.l) = 1
    If Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      If H_CheckIfRowSetExists(Row.l) < 1
        LastElement(CSGrid_Row())
        AddElement(CSGrid_Row())
        CSGrid_Row()\hWnd = Gadget.l
        CSGrid_Row()\row = Row.l
      EndIf
      CSGrid_Row()\caption = Caption.s
      H_DrawGrid(-1)
    EndIf
  EndIf
EndProcedure
Procedure.s CSGridGadget_GetRowCaption(Gadget.l,Row.l) ; Returns a Row-Caption of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln einer Zeilenbeschriftung
  If H_GetGadget(Gadget.l) = 1
    If Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetRowCaption(Row.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetRowDetailsHandle(Gadget.l,Row.l,handle.l,height.l) ; Sets a Row-Details-Object-Handle of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen eines Zeilen-Details-Objektes
  If IsGadget(handle.l) Or handle.l = 0
    If H_GetGadget(Gadget.l) = 1
      If Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
        If H_CheckIfRowSetExists(Row.l) < 1
          LastElement(CSGrid_Row())
          AddElement(CSGrid_Row())
          CSGrid_Row()\hWnd = Gadget.l
          CSGrid_Row()\row = Row.l
        EndIf
        CSGrid_Row()\hDetails = handle.l
        If handle.l > 0
          CSGrid_Row()\DetailsHeight = height.l
          HideGadget(handle,1)
          CSGrid_Row()\DetailsVisible = -1
        Else
          CSGrid_Row()\DetailsHeight = 0
        EndIf
        H_DrawGrid(-1)
      EndIf
    EndIf
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetRowDetailsHandle(Gadget.l,Row.l) ; Returns a Row-Details-Object-Handle of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln einer Zeilenbeschriftung
  If H_GetGadget(Gadget.l) = 1
    If Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetRowDetailsHandle(Row.l)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetCellValue(Gadget.l,Col.l,Row.l,Value.s) ; Sets a Cell-Value of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Zell-Inhalts
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      H_SetCellValue(Col.l,Row.l,Value.s)
    EndIf
  EndIf
EndProcedure
Procedure.s CSGridGadget_GetCellValue(Gadget.l,Col.l,Row.l) ; Returns a Cell-Value of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln eines Zellen-Inhalts
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetCellValue(Col.l,Row.l)
    EndIf  
  EndIf
EndProcedure
Procedure CSGridGadget_SetCellLockStatus(Gadget.l,Col.l,Row.l,Status.l) ; Sets the Lock-Status of a Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Sperr-Zustandes einer Zelle
  Protected tcell.l
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      tcell.l = (CSGrid()\Cols * Row.l) + Col.l + CSGrid()\CellMatrixStartID
      If tCell.l >= 0
        SelectElement(CSGrid_Cell(),tcell.l)
        CSGrid_Cell()\lock = Status.l
        H_DrawGrid(-1)
      EndIf
    EndIf
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetCellLockStatus(Gadget.l,Col.l,Row.l) ; Returns the Lock-Status of a Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Sperr-Zustandes einer Zelle
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn H_GetCellLockStatus(Col.l,Row.l)
    EndIf  
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorBackground(Gadget.l,Color.l) ; Sets the Background-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Hintergrundfarbe
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_Backgr = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorBackground(Gadget.l) ; Returns Background-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Hintergrundfarbe
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_Backgr 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorGrid(Gadget.l,Color.l) ; Sets the Gridlines-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe der Gitternetzlinien
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_Grid = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorGrid(Gadget.l) ; Returns Gridlines-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe der Gitternetzlinien
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_Grid 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellBackDef(Gadget.l,Color.l) ; Sets the Cell's default Background-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Standard Hintergrundfarbe der Zellen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellBack = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellBackDef(Gadget.l) ; Returns Cell's default Background-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Standard Hintergrundfarbe der Zellen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellBack 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellTextDef(Gadget.l,Color.l) ; Sets the Cell's default Text-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Standard Schrift-Farbe der Zellen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellFore = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellTextDef(Gadget.l) ; Returns Cell's default Text-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Standard Schrift-Farbe der Zellen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellFore 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorColRowCapt(Gadget.l,Color.l) ; Sets the Color of the Column/Row-Header of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für die Spalten-/Zeilen-Überschriften
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CaptBack = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorColRowCapt(Gadget.l) ; Returns Cell's default Text-Color of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für die Spalten-/Zeilen-Überschriften
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CaptBack 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellBackFocus(Gadget.l,Color.l) ; Sets the Color of a focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für fokusierte Zellen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellFocus = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellBackFocus(Gadget.l) ; Returns the Color of a focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für fokusierte Zellen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellFocus 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorColRowCaptFocus(Gadget.l,Color.l) ; Sets the Color of the Header of a focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für Spalten-/Zeilen-Überschriften von fokusierte Zellen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CaptFocus = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorColRowCaptFocus(Gadget.l) ; Returns the Color of the Header of a focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für Spalten-/Zeilen-Überschriften von fokusierte Zellen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CaptFocus 
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellBackLock(Gadget.l,Color.l) ; Sets the Color of a locked Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für eine gesperrte Zelle
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellLock = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellBackLock(Gadget.l) ; Returns the Color of a locked Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für eine gesperrte Zelle
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellLock
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellBackLockFocus(Gadget.l,Color.l) ; Sets the Color of a locked, focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für eine gesperrte, fokusierte Zelle
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellLoFoc = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellBackLockFocus(Gadget.l) ; Returns the Color of a locked, focused Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für eine gesperrte, fokusierte Zelle
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellLoFoc
  EndIf
EndProcedure
Procedure CSGridGadget_SetColorCellBackFocusInactive(Gadget.l,Color.l) ; Sets the Color of a focused Cell of a inactive CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Farbe für eine fokusierte Zelle eines inaktiven Gadgets
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Color_CellFocusInact = Color.l
    H_DrawGrid(-1)
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetColorCellBackFocusInactive(Gadget.l) ; Returns the Color of a focused Cell of a inactive CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Farbe für eine fokusierte Zelle eines inaktiven Gadgets
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Color_CellFocusInact
  EndIf
EndProcedure
Procedure CSGridGadget_SetGridLinesVisibility(Gadget.l,Visible.l) ; Sets the flag for visibility of the Grid-Lines of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Gitternetzlinien
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\GridVisible = Visible.l
    H_DrawGrid(-1)
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetGridLinesVisibility(Gadget.l) ; Returns the flag for visibility of the Grid-Lines of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Gitternetzlinien
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\GridVisible
  EndIf  
EndProcedure
Procedure CSGridGadget_SetColCaptionVisibility(Gadget.l,Visible.l) ; Sets the flag for visibility of the Column-Headers of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Spaltenköpfen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\ColCaptVisible = Visible.l
    H_DrawGrid(-1)
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetColCaptionVisibility(Gadget.l) ; Returns the flag for visibility of the Column-Headers of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Spaltenköpfen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\ColCaptVisible
  EndIf  
EndProcedure
Procedure CSGridGadget_SetRowCaptionVisibility(Gadget.l,Visible.l) ; Sets the flag for visibility of the Row-Headers of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Sichtbarkeit von Zeilenköpfen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\RowCaptVisible = Visible.l
    H_DrawGrid(-1)
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetRowCaptionVisibility(Gadget.l) ; Returns the flag for visibility of the Row-Headers of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Sichtbarkeit von Zeilenköpfen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\RowCaptVisible
  EndIf  
EndProcedure
Procedure CSGridGadget_SetColsScaleable(Gadget.l,Enabled.l) ; Sets the flag for customizing width of Columns of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Abänderbarkeit von Spaltenbreiten
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\ColCustWidth = Enabled.l
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetColsScaleable(Gadget.l) ; Returns the flag for customizing width of Columns of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Abänderbarkeit von Spaltenbreiten
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\ColCustWidth
  EndIf  
EndProcedure
Procedure CSGridGadget_SetColsUserSort(Gadget.l,Enabled.l) ; Sets the flag for customizing sorting of Columns of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Abänderbarkeit von Spaltensortierungen
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\UserSort = Enabled.l
    H_DrawGrid(-1)
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetColsUserSort(Gadget.l) ; Returns the flag for customizing sorting of Columns of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Abänderbarkeit von Spaltensortierungen
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\UserSort
  EndIf  
EndProcedure
Procedure CSGridGadget_SetAutoSort(Gadget.l,Enabled.l) ; Sets a auto-sort flag for a CS-Grid-Gadget
  ; PUBLIC-Funktion zur Aktivierung der automatischen Sortierung
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      CSGrid()\AutoSort = Enabled.l
    EndIf
  EndIf
EndProcedure
Procedure.l CSGridGadget_GetAutoSort(Gadget.l) ; Returns a the auto-sort flag of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Aktivierung der automatischen Sortierung
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And CSGrid()\hWnd <> 0
      ProcedureReturn CSGrid()\AutoSort
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_SetAutoRedraw(Gadget.l,Enabled.l) ; Sets the flag for auto-redraw of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der autom. Zeichnung bei Änderung
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\AutoRedraw = Enabled.l
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetAutoRedraw(Gadget.l) ; Returns the flag for auto-redraw of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der autom. Zeichnung bei Änderung
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\AutoRedraw
  EndIf  
EndProcedure
Procedure CSGridGadget_SetFont(Gadget.l,Font.l) ; Sets the font of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen der Schriftart
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\Font = Font.l
    H_DrawGrid(-1)
  EndIf  
EndProcedure
Procedure.l CSGridGadget_GetFont(Gadget.l) ; Returns the font of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln der Schriftart
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn CSGrid()\Font
  EndIf  
EndProcedure
Procedure CSGridGadget_SetFormatComma(Gadget.l,Char.s) ; Sets the comma-symbol for a formatted output of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Definieren des Komma-Zeichens für die formatierte Zahlenausgabe
  If H_GetGadget(Gadget.l) = 1
    CSGrid()\CommaSep = Asc(Char.s)-127
  EndIf  
EndProcedure
Procedure.s CSGridGadget_GetFormatComma(Gadget.l) ; Returns the comma-symbol of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Ermitteln des Komma-Zeichens für die formatierte Zahlenausgabe
  If H_GetGadget(Gadget.l) = 1
    ProcedureReturn Chr(CSGrid()\CommaSep+127)
  EndIf  
EndProcedure
Procedure CSGridGadget_SetCursor(Gadget.l,Col.l,Row.l) ; Sets the cursor to a Cell of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen des Cursors
  If H_GetGadget(Gadget.l) = 1
    If Col.l < CSGrid()\Cols And Col.l >= 0 And Row.l < CSGrid()\Rows And Row.l >= 0 And CSGrid()\hWnd <> 0
      If H_GetCellLockStatus(Col.l,Row.l) > -16
        H_SetCursor(0,Col.l,Row.l)
      EndIf
    EndIf  
  EndIf
EndProcedure
Procedure CSGridGadget_SetCursorRange(Gadget.l,StartCol.l,StartRow.l,EndCol.l,EndRow.l) ; Sets the cursor to a range of Cells of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Setzen eines Markierungsbereichs
  If H_GetGadget(Gadget.l) = 1
    If StartCol.l < CSGrid()\Cols And StartCol.l >= 0 And StartRow.l < CSGrid()\Rows And StartRow.l >= 0 And EndCol.l < CSGrid()\Cols And EndCol.l >= 0 And EndRow.l < CSGrid()\Rows And EndRow.l >= 0 And CSGrid()\hWnd <> 0
      If H_GetCellLockStatus(StartCol.l,StartRow.l) > -16
        H_SetCursor(0,StartCol.l,StartRow.l)
      EndIf
      If H_GetCellLockStatus(EndCol.l,EndRow.l) > -16      
        H_SetCursor(0,EndCol.l,EndRow.l)
      EndIf    
    EndIf
  EndIf
EndProcedure  
Procedure CSGridGadget_CopySelectionToClipboard(Gadget.l) ; Copies the actual cursor selection of a CS-Grid-Gadget to the clipboard
  ; PUBLIC-Funktion zum Kopieren der aktuellen Markierung in die Zwischenablage
  Protected tx.l,ty.l, tclip.s
  If H_GetGadget(Gadget.l) = 1
    If StartCol.l < CSGrid()\Cols And StartCol.l >= 0 And StartRow.l < CSGrid()\Rows And StartRow.l >= 0 And EndCol.l < CSGrid()\Cols And EndCol.l >= 0 And EndRow.l < CSGrid()\Rows And EndRow.l >= 0 And CSGrid()\hWnd <> 0
      If CSGrid()\ColCaptVisible = 1
        tclip = Chr(7)
        For tx = CSGrid()\ActColStart To CSGrid()\ActColEnd
          If H_GetColWidth(tx) > 0
            tclip + H_GetColCaption(tx)
            If tx < CSGrid()\ActColEnd
              tclip + Chr(9)
            EndIf            
          EndIf          
        Next
        tclip + Chr(13) + Chr(10)
      EndIf
      For ty = CSGrid()\ActRowStart To CSGrid()\ActRowEnd
        For tx = CSGrid()\ActColStart To CSGrid()\ActColEnd
          If H_GetColWidth(tx) > 0
            If H_GetCellLockStatus(tx,ty) > -16
              tclip + H_FormatCell(H_GetCellValue(tx,ty),H_GetColDataType(tx))
            EndIf
            If tx < CSGrid()\ActColEnd
              tclip + Chr(9)
            EndIf            
          EndIf
        Next
        If ty < CSGrid()\ActRowEnd
          tclip + Chr(13) + Chr(10)
        EndIf
      Next
      SetClipboardText(tclip)
    EndIf
  EndIf
EndProcedure
Procedure CSGridGadget_PasteClipboardToSelection(Gadget.l) ; Pastes the clipboard content to the actual cursor of a CS-Grid-Gadget
  ; PUBLIC-Funktion zum Einfügen des Inhaltes aus der Zwischenablage an die Cursor-Position
  Protected tClip.s,tpos.l, tline.s, tx.l, ty.l, fRedraw.l
  If H_GetGadget(Gadget.l) = 1
    tClip = GetClipboardText()
    fRedraw = CSGrid()\AutoRedraw
    CSGrid()\AutoRedraw = -1
    ; Spaltenköpfe ausblenden
    If Left(tClip.s,1) = Chr(7) 
      tpos = FindString(tClip,Chr(13)+Chr(10),2)
      If tpos > 0
        tClip = Right(tClip,Len(tClip)-tpos-1)
      EndIf
    EndIf    
    While Len(tClip.s) > 0 And (ty+CSGrid()\ActRowEnd) < CSGrid()\Rows
      tpos = FindString(tClip,Chr(13)+Chr(10),1)
      If tpos > 0
        tline = Left(tClip,tpos-1)
        tClip = Right(tClip,Len(tClip)-tpos-1)
      Else
        tline = tClip
        tClip = ""
      EndIf
      tx = 0
      While Len(tline) > 0 And (tx+CSGrid()\ActColEnd) < CSGrid()\Cols
        tpos = FindString(tline,Chr(9),1)
        If tpos > 0 
          H_SetCellValue(CSGrid()\ActColEnd+tx,CSGrid()\ActRowEnd+ty,Left(tline,tpos-1))
          tline = Right(tline,Len(tline)-tpos)
          tx + 1
        Else
          H_SetCellValue(CSGrid()\ActColEnd+tx,CSGrid()\ActRowEnd+ty,tline)
          tline = ""
        EndIf
      Wend        
      ty + 1
    Wend
    CSGrid()\AutoRedraw = fRedraw
    H_DrawGrid(-1)
  EndIf  
EndProcedure
to be continued...