[Gambas-user] TableView.Clear in Gambas3

wig wig at ...1809...
Wed Jun 18 12:40:33 CEST 2014


B.: thanks for fixing.
R: For me the table works; this is the code that concerns the table:

>From the click I call TableView1.Edit, and then TableView1_Save explicitly
stores the value.
The other lines is just a counter in the first column.


Public Sub TableView1_Click()

  Debug TableView1.Column
  Debug TableView1.Row
  If TableView1.Column > 0 And TableView1.Row <= iRowCounter
    ' grow table rows if needed
    If TableView1.Row = TableView1.Rows.Count - 1
      Inc TableView1.Rows.Count
      Inc iRowCounter
    Endif
    ' repeat name of group
    If TableView1.Row > 0 And TableView1.Column = iColName
      TableView1[TableView1.Row, TableView1.Column].Text =
TableView1[TableView1.Row - 1, TableView1.Column].Text
    Endif
    TableView1.Edit
  Endif

End


Public Sub TableView1_Save(Row As Integer, Column As Integer, Value As
String)

  TableView1[Row, Column].Text = Value
  TableView1[Row, iColNr].Text = Row
  iRowCounter = Row
  Inc iRowCounter

End




Public Sub initTable()

With TableView1
.Clear()
.columns.Count = iColRemark + 1
.Rows.Count = 2
End With

TableView1.Columns[iColNr].Text = "Pos"
TableView1.Columns[iColName].Text = "GrpName"
TableView1.Columns[iColKey].Text = "KeyName"
TableView1.Columns[iColDescription].Text = "Description"
TableView1.Columns[iColDefault].Text = "Default Val"
TableView1.Columns[iColRemark].Text = "Remark"

End



The rest of the project also stores the table data to a file and reads it
back.
You can get the code in the state it is / being worked on at
http://sourceforge.net/projects/garlic3/files/Tools/GbSettingsTool/Archive/


Hope that helps.

Greeting,

WiG


> I don't suppose whoever sent in this post originally would email me
> their mini-project example.
>
> I'm using the table view and can't consistantly get the tableview1_save
> to work - the data looks like it is in the table on the screen, but if
> you try and read it back to e.g save, it is inconsistanly not there. If
> I as the user go back to the cell in the grid and hit the <enter> key
> then it is, but if I'd just typed in the data then moved off the
> tableview to somewhere else, as I say it looks like its in the table but
> is not ie the save event not triggered. ?any solutions/example
>
> richard
>
> On 18/06/14 10:40, Benoît Minisini wrote:
>> Le 13/06/2014 09:51, wig a écrit :
>>> I tried to search for other mention of this item, and I might be
>>> missing
>>> something, but the Clear function seems to leave one cell "not-cleared"
>>> in
>>> my TableView.
>>>
>>> Replicate: make a table, with edit and save code, fill some cells,
>>> clear
>>> the table with TableView1.Clear
>>>
>>> One of the cells stays filled with the same content it had (mostly the
>>> last one that was filled - so I tried to be sure I left the cell after
>>> editing by doing something else on screen, like change a spinbox
>>> value).
>>>
>>> Version: Gambas 3.4.1 and 3.4.2, on OpenSUSE 13.1/KDE
>>>
>>> Demo project included (with screenshots).
>>>
>>> FMain :
>>>
>>> Public Sub _new()
>>>     TableView1.Columns.Count = 6
>>>     TableView1.Rows.Count = 20
>>> End
>>>
>>> Public Sub TableView1_Click()
>>>
>>>     Debug TableView1.Column
>>>     Debug TableView1.Row
>>>
>>>     TableView1.Edit()
>>>
>>> End
>>>
>>> Public Sub Form_Open()
>>>
>>> End
>>>
>>> Public Sub Button1_Click()
>>>
>>>     TableView1.Clear
>>>
>>> End
>>>
>>> Public Sub TableView1_Save(x As Integer, y As Integer, sText As String)
>>>
>>>     TableView1[x, y].Text = sText
>>>
>>> End
>>>
>> Fixed in revision #6327.
>>
>> As a workaround, call the Cancel() method before calling Clear().
>>
>> Regards,
>>
>
>
> ------------------------------------------------------------------------------
> HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
> Find What Matters Most in Your Big Data with HPCC Systems
> Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> Leverages Graph Analysis for Fast Processing & Easy Data Exploration
> http://p.sf.net/sfu/hpccsystems
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>






More information about the User mailing list