Page 1 of 1

Clicking on a TsBrowse Column, can it execute a Function?

Posted: Mon Mar 20, 2006 1:42 pm
by Jules de Pierre
Can I implement a function when clicking on the top of a column in a TsBrowse.
If so, how can I initate that?

In Windows apps you can click on the top of a column and it changes its sequence in alphabetical order f.i.

I use TsBrowse with great pleasure in all my apps.

Thanks for a reply.

Jules
[/b]

Posted: Mon Mar 20, 2006 4:46 pm
by tnhoe
oBrw:aActions := { {||msgstop('col 1')}, {||msgstop('col 2')}, {||msgstop('col 3')}, ... }

Clicking on a TsBrowse Column

Posted: Mon Mar 20, 2006 8:16 pm
by Jules de Pierre
TNHOE,

Thanks for respnding,
Can you give more detailed info?
Where should I place the command: oBrW:aActions
How could the Array look like ,example

Should the function: msgstop('col 1') define the order of records ?

Thanks again.

Jules

Posted: Tue Mar 21, 2006 12:20 am
by tnhoe
select('invoice') // fields: invoice,date,custcode

REDEFINE BROWSE oBrw ALIAS "invoice" ID 101 OF oDlg

oBrw:LoadFields( .T. ) // load all fields from dbf

oBrw:aActions:={ {|| fCol('1') },{|| fCol('2') },{|| fCol('3') } }

:
:

return .t.


// Your user defined function below,

function fCol(cX)

msginfo('Header Column clicked : '+cX)

select('invoice')
do case
case cX='1'
set order to tag invoice
case cX='2'
set order to tag date
case cX='3'
set order to tag custcode
endcase
oBrw:refresh()

return .t.