[Gambas-user] Gridview sort function

T Lee Davidson t.lee.davidson at ...626...
Fri Dec 26 18:22:26 CET 2014


On 12/24/2014 05:40 PM, B Bruen wrote:
> On Wed, 24 Dec 2014 11:57:11 -0500
> T Lee Davidson <t.lee.davidson at ...626...> wrote:
>
>> Apparently I didn't take enough time, Bill.
>>
>> I only tested that the text of the TextBox changed appropriately for a column_click, I did not test clicking Button1.
>>
>> You are right. The value of TableView.Columns.Ascending within the Column_Click event does not agree with the value outside of the Column_Click
>> event. I do not understand this behavior.
>>
>> So I'd say that either there is something missing in the documentation, or this is a bug. I have attached a modified version of your sample that
>> shows this anomaly more clearly.
>>
>> Can anyone else shed some light on this?
>>
>>
>> Lee
>> __________
>>
>> "Artificial Intelligence is no match for natural stupidity."
>>
>
> This may shed a bit of light:
>
> Public Sub TableView1_ColumnClick(Column As Integer)
>
> The "Column" value in the click handler is the newly "selected" column, however the sort values have not been set yet, this happens after the click handler has finished. So you are not correctly displaying the sort values in the TextBox1.
>
> Attached updated project with some more debug info that shows the actual sort values.
>
> After you have waded through that a bit, uncomment lines 11 and 12 which should really confuse you :-)
>
> cheers
> Bruce
>

Yes, that does explain it. Thanks Bruce.

It is clear now that the TableView sort properties (.Sort and .Ascending) are not to be relied upon within the Column_Click event. But they can 
indeed be relied upon within the Sort event.

Bill, does that help?


Lee
__________

"Artificial Intelligence is no match for natural stupidity."




More information about the User mailing list