' Editable Tablecell
' ==================
' Add a form1
' Add a textbox1
' Add a table1
' Add a timer1
'
' !!WORKS ONLY ON PPC!!
Sub Globals
scol = ""
srow = 0
I = -1
scolh = "hidden"
End Sub
Sub App_Start
Form1.show
sip(false) ' keine Tastatur
table1.addcol(cString, "hidden", 0)
table1.addcol(cString, "Name", 60)
table1.addcol(cString, "Vorname", 60)
table1.addrow()
textbox1.visible = false
End Sub
Sub Table1_SelectionChanged (ColName, Row)
scol = ColName
srow = Row
if table1.selectedcol = "hidden" then
return ' Abbruch
end if
I = -1
timer1.enabled = true
SIP(true)
table1.cell(scolh,srow) = table1.cell(scol,srow) ' Hilfszelle bekommt den Wert der Zelle
End Sub
Sub TextBox1_KeyPress (key)
if key = chr(13) then ' Return gedrückt
table1.focus = true
SIP(false)
timer1.enabled = false
CellFinal
table1.selectcell("hidden",srow)
return
end if
if key =chr(8) then ' Backspace gedrückt
if StrLength(table1.cell(scolh,srow)) > 0 then
cellstr = table1.cell(scolh,srow)
newstr = substring(cellstr, 0, StrLength(cellstr)-1)
table1.cell(scolh,srow) = newstr
table1.cell(scol,srow) = table1.cell(scolh,srow)
return
else
return ' wenns = 0 ist nur return, ansonsten wird ein Block angezeigt
end if
end if
table1.cell(scolh,srow) = table1.cell(scolh,srow) & key
CellFinal
End Sub
Sub CellFinal
table1.cell(scol,srow) = table1.cell(scolh,srow)
End Sub
Sub Timer1_Tick
if I < 0 then
BlinkOn
else
BlinkOff
end if
I = I *(-1)
textbox1.Focus = true
End Sub
Sub BlinkOn
table1.cell(scol,srow) = table1.cell(scolh,srow) & "I"
End Sub
Sub BlinkOff
if StrLength(table1.cell(scol,srow)) <> 0 then
table1.cell(scol,srow) = substring(table1.cell(scol,srow), 0, StrLength(table1.cell(scol,srow))-1)
end if
End Sub