[Gambas-user] Endless DATA event in Table

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Oct 19 19:20:43 CEST 2015


Am 15.10.2015 18:53, schrieb Benoît Minisini:
> Le 15/10/2015 18:23, Rolf-Werner Eilert a écrit :
>> Am 15.10.2015 18:11, schrieb Benoît Minisini:
>>> Le 15/10/2015 17:51, Rolf-Werner Eilert a écrit :
>>>> In my project there is a TabView with 4 tabs, on two of them there is a
>>>> TableView. And there is a TreeView with names.
>>>>
>>>> When I choose a name, and the first Tab is open, the Table there is
>>>> filled with data, and there it stops and waits. So the DATA event runs
>>>> through only once after it was triggered by setting Rows.Count.
>>>>
>>>> When I click on the other Tab with the other Table, it keeps filling and
>>>> filling and filling, so the program is slowed down. But Rows.Count is
>>>> set only once there, too. And there is nothing within the Data event
>>>> loop which could set it again while filling.
>>>>
>>>> As soon as I click on another Tab, it stops filling that Table. Same
>>>> when I click on some root entry in the TreeView which empties the
>>>> Tables. So when GUI moves the focus away from that Table, it stops as
>>>> expected.
>>>>
>>>> My problem is, I cannot find any reason for that specific TableView to
>>>> be triggered over and over again. Does anyone here have had such a case
>>>> and could me point where to start looking?
>>>>
>>>> Thanks for any hints!
>>>>
>>>> Rolf
>>>>
>>> Can you provide a project?
>>>
>> Hm no, it's way too large... but I can show excerpts if you like:
>>
>> This is the table "tbd" which runs normally:
>>
>>      ldsv.ListeFelder(baum.Current.Key, links, rechts)
>>      tbd.Rows.Count = links.Count
>>      tbd.Columns.Count = 2
>>      tbd.Columns[1].Width = tbd.Columns[0].Width * 3
>>
>>
>> Public Sub tbd_Data(Row As Integer, Column As Integer)
>>
>>      If TabelleAnzeigen Then
>>        tbd.Data.Text = TabellenZelle(tblDaten[Row + 2], Column + 1)
>>
>>      Else
>>        If Column = 0 Then
>>          tbd.Data.Text = links[Row]
>>        Else If Column = 1 Then
>>          tbd.Data.Text = rechts[Row]
>>        End If
>>      End If
>>
>> End
>>
>> This is the table "tbk" which is running over and over again:
>>
>>      ldsv.ListeKonto(baum.Current.Key, ktNr, ktDatum, ktText, ktSoll,
>> ktHaben, ktModus)
>>
>>      konto.ListeKTXbisJetzt(baum.Current.Key, text, soll)
>>
>>      konto.ListeKTXansKonto(ktNr, ktDatum, ktText, ktSoll, ktHaben,
>> ktModus, text, soll, nix)
>>
>>      tbk.Rows.Count = ktNr.Count
>>      tbk.Columns.Count = 5
>>      tbk.Columns[1].Width = tbk.Columns[0].Width * 2
>>      tbk.Columns[2].Width = tbk.Columns[0].Width / 1.5
>>      tbk.Columns[3].Width = tbk.Columns[0].Width / 1.5
>>      tbk.Columns[4].Width = tbk.Columns[0].Width / 3
>>      tbk.Columns[0].Text = "Datum"
>>      tbk.Columns[1].Text = "Text"
>>      tbk.Columns[2].Text = tbkRechtsbuendig(2, "Soll")
>>      tbk.Columns[3].Text = tbkRechtsbuendig(3, "Haben")
>>      tbk.Columns[4].Text = "Modus"
>>
>>      If ktModus[ktModus.Count - 1] = "O" Then  'altes Konto
>>        tbk.Font.Name = "Courier"                 'Schrift Courier
>>      Else                                      'neues Konto
>>        tbk.Font.Name = tbd.Font.Name             'Schrift wie Datentabelle
>>      End If
>>
>>      tbk.MoveTo(tbk.Rows.Count - 1, tbk.Columns.Count - 1)
>>      tbk.Current.EnsureVisible
>>
>>
>> Public Sub tbk_Data(Row As Integer, Column As Integer)
>>
>>      Select Case Column
>>      Case 0
>>        tbk.Data.Text = ktDatum[Row]
>>        If ktDatum[Row] <> "" And ktModus[Row] <> "N" Then
>>          tbk.Background = Color.RGB(230, 230, 230)
>>        Else
>>          tbk.Background = color.White
>>        End If
>>
>>      Case 1
>>        tbk.Data.Text = ktText[Row]
>>        If ktText[Row] <> "" And ktModus[Row] <> "N" Then tbk.Background =
>> color.RGB(230, 230, 230)
>>        If ktModus[Row] = "K" Then
>>          tbk.Data.RichText = "<i><b><font color=\"#0000FF\">" &
>> ktText[Row] & "</font></b></i>"
>>        End If
>>
>>      Case 2
>>        tbk.Data.Text = cent2wert(ktSoll[Row])
>>        tbk.Data.Alignment = Align.Right
>>        If ktSoll[Row] <> "" And ktModus[Row] <> "N" Then tbk.Background =
>> Color.RGB(230, 230, 230)
>>        If ktModus[Row] = "K" Then tbk.Background = color.RGB(230, 230, 230)
>>
>>      Case 3
>>        Select Case saldoZeile(Row)
>>        Case -1                     'Minderbetrag
>>          If Trim$(ktHaben[Row]) = "" Then
>>            tbk.Data.RichText = "<i><b><font color=\"#FF0000\">" & "-,--" &
>> "</font></b></i>"
>>          Else
>>            tbk.Data.RichText = "<i><b><font color=\"#FF0000\">" &
>> cent2wert(ktHaben[Row]) & "</font></b></i>"
>>          End If
>>        Case 0                      'Ausgleich
>>          tbk.Data.RichText = "<b><font color=\"#0000FF\">" &
>> cent2wert(ktHaben[Row]) & "</font></b>"
>>        Case 1                      'Überzahlung
>>          tbk.Data.RichText = "<b><font color=\"#00A600\">" &
>> cent2wert(ktHaben[Row]) & "</font></b>"
>>        End Select
>>        tbk.Data.Alignment = Align.Right
>>        If ktHaben[Row] <> "" And ktModus[Row] <> "N" Then tbk.Background =
>> Color.RGB(230, 230, 230)
>>        If ktModus[Row] = "K" Then tbk.Background = Color.RGB(230, 230, 230)
>>
>>      Case 4
>>        tbk.Data.Text = ktModus[Row]
>>        If ktModus[Row] <> "" And ktModus[Row] <> "N" Then tbk.Background =
>> color.RGB(230, 230, 230)
>>
>>      End Select
>>
>> End
>>
>> As soon as I can see, it doesn't contain any code that would trigger it
>> all over (if that is possible anyway).
>>
>> Thanks
>> Rolf
>>
> If you put a breakpoint at the beginning of the Data event handler, what
> is the stack backtrace?
>

Finally, I found the reason: I must write tbk.Data.Background, not 
tbk.Background.

That made it so slow!

Regards
Rolf





More information about the User mailing list