On Mon, Oct 27, 2008 at 5:10 PM, Alex Fenton <span dir="ltr"><<a href="mailto:alex@pressure.to">alex@pressure.to</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Glen Holcomb wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What would be the best way to sort a grid by the column the user clicks on? I have a bunch of database info being represented in grids (via GridTableBase) that I would like to be sortable by different columns. I didn't see anything in the Grid or GridTableBase about a column select event.<br>
</blockquote></div>
There is an event evt_grid_label_left_click which is fired when a row or column header is clicked on. You can call get_col on the event object to find out which column was clicked. There are also similar events for right clicks and double clicks.<br>
<br>
To re-order a column, I think it should be enough to change what GridTableBase is returning in your case, and then calling refresh on the Grid.<br>
<br>
To select a whole column just use Grid#select_col method.<br>
<br>
cheers<br>
alex<br>
_______________________________________________<br>
wxruby-users mailing list<br>
<a href="mailto:wxruby-users@rubyforge.org" target="_blank">wxruby-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/wxruby-users" target="_blank">http://rubyforge.org/mailman/listinfo/wxruby-users</a><br>
</blockquote></div><br>Thanks Alex!<br><br>It works beautifully.<br><br>-Glen<br clear="all"><br>-- <br>"Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." <br>
<br>-Greg Graffin (Bad Religion)<br>