[Gambas-user] Bug in Gambas TableView

Benoit Minisini gambas at ...1...
Sun Jan 22 22:38:52 CET 2006


On Sunday 22 January 2006 22:21, Andrea Grandi wrote:
> Hi,
>
> please try this thing.
>
> - open the sample project "Database" and add this Sub to the FRequest form:
>
> PUBLIC SUB tbvData_DblClick()
>  $rData.MoveTo(tbvData.Row)
>
>  Message("ID Cliente: " & $rData["id"])
>  Message("FirstName: " & $rData["firstname"])
>  Message("Name: " & $rData["name"])
> END
>
> As you can understand this sub should show three message dialog with
> the ID, then firstname, then name of the selected row.
>
> The problem is that for example, if you double-click row number 23,
> you see the correct ID of the row 23, then you see the firstname and
> the name of the row 24.
>
> Try as many time as you want. Every time, after you read a value in
> the selected row, the current row is set to the next row available.
>
> How is it possible?
>
> Thanks for your support!
>
> p.s: I'm using Gambas 1.9.23
>

This is not a bug :-)

It is possible because the Data event is raised when the TableView is redrawn.

As you display message boxes, the TableView is redrawn whan a message box is 
hidden, just before the other is shown, and so some Data events are raised, 
and so the Result object is moved after each Message() call.

Use the PRINT instruction instead of Message boxes, and the problem 
disappears.

Regards,

-- 
Benoit Minisini





More information about the User mailing list