Sort on column header click

Sort on column header click

Postby Jeff Barnes » Tue Dec 20, 2005 12:51 am

Hi,

I have a listbox with 8 columns ... I would like to allow the user to sort the data by clicking on a column header, how can I do this?

Thanks,
Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Sort on ListBox

Postby Colin Haig » Tue Dec 20, 2005 3:41 am

Jeff

Use aTags

aTags := { {|| nTag := 1,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 2,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 3,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 4,HeadSort(oQuote,oLbx,nTag)},;
{|| nTag := 5,'' },;
{|| nTag := 6,HeadSort(oQuote,oLbx,nTag)}}

static function HeadSort(oQuote,oLbx,nTag)
do case
case nTag == 1
oQuote:SetOrder('QUOTENO')
oQuote:Bottom()
oLbx:GoBottom()
case nTag == 2
oQuote:SetOrder('CLIENT')
oQuote:Top()
oLbx:GoTop()
case nTag == 3
oQuote:SetOrder('QDATE')
oQuote:Top()
case nTag == 4
oQuote:SetOrder('CONTACT')
oQuote:Top()
case nTag == 6
oQuote:SetOrder('PROJECT')
oQuote:Top()
endcase
oLbx:Refresh()
oLbx:SetFocus()
return(nil)
//------------------------------------------------------------------------------//

Hope this helps

Cheers

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Postby Jeff Barnes » Tue Dec 20, 2005 8:19 pm

Thanks Colin,

That pointed me in the right direction :-)


Jeff
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 85 guests