[ Home | Contents | Search | Next | Previous | Up ]
Date: 11/30/99
Time: 12:17:34 AM
Q. Hi, using Bc5 for windows programming using OWL. Does anybody know how
to create the 'sort' buttons eg the 'From' 'Sent' buttons on the newsgroup
software which sort a list in ascending or descending order alphabetically or numerically
??
A.Use the TListWindow control in report mode (LVS_REPORT). Add TColumnHeaders to
the list window as shown in bc5\examples\owl\classes\listwind. Capture the button click
event in the window that owns the list window by adding
EV_LVN_COLUMNCLICK(IDC_LINESVIEW,
LVNColumnclick),
to its response table. (here, IDC_LINESVIEW is the ID of the list
window and LVNColumnclick is the function that responds to the event). OWL passes
a TLwNotify object to the event handler. the TLwNotify::iSubItem tells you which (0-based)
column header was clicked. My response function looks
like:
void TEditLinesDialog::LVNColumnclick(TLwNotify& lwn)
{
switch ( lwn.iSubItem ) {
default :
case 0 :
ToggleLegend();
break;
case 1 :
ChooseColor();
break;
case 2 :
ChooseStyle();
break;
case 3 :
SetThickness();
break;
}
}
Obviously, I perform different functions depending upon which column header is clicked.
You probably just want to sort the data in a particular column.
Regards,
Scott