Hi Guys,
 
JL> Good idea. I should have thought of it! I look forward to seeing your
implementation.
 
Well here is what I did:
 
0) use i_LC_Header; #Attached.
 
NB, I have commented out "use i_lib" and "__set_format" lines (without
testing) because these were my personal formatting.  You can reinstitute
your own routines if you want.
 
1) First of all add "|wxLC_NO_HEADER" to your Wx::ListCtrl like this
 
    $self->{Ctl_Appointments_Lst} =
     Wx::ListCtrl->new($self, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxLC_REPORT|wxSUNKEN_BORDER|wxLC_SINGLE_SEL|wxLC_NO_HEADER);
 
2) Create a 1-line panel with a sizer for your heading (using the attached
module):

    # Panel & sizer
    $self->{Ctl_Appointments_Panel_Szr} = Wx::BoxSizer->new(wxHORIZONTAL); #
New Sizer
    my $loc_panel = i_LC_Header->new($self, wxID_ANY, wxDefaultPosition,
[1440,-1], wxBORDER_NONE, $self->{Ctl_Appointments_Panel_Szr} );
 
3) Create as many column headers as you want like this:

    # Patient name column header
    $self->{Ctl_Appointments_Patient_Name_Pnl} =
$loc_panel->AppendColumnHeader($self, wxID_ANY, wxDefaultPosition, [280, -1]
, 'Patient Name');
   
(you must keep any existing column heading code like this, otherwise the
table columns will not get created and you'll get a blank table n-lines
long:
 
    $self->{Ctl_Appointments_Lst} ->InsertColumn(0, 'Patient Name');
# You probably don't need the name string here.
    $self->{Ctl_Appointments_Lst} ->SetColumnWidth(0, 275);
 
)
 
4) Add the new panel to your sizer BEFORE the ListCtrl itself, like this:
 
    $self->{Ctl_Appointments_Master_Szr}->Add($loc_panel, 0,0, 0);
# New header line.
 
$self->{Ctl_Appointments_Master_Szr}->Add($self->{Ctl_Appointments_Appointme
nts_Lst}, 1, wxEXPAND, 0);

Good luck.
 
Any comments or improvements welcome.
 
Regards

Steve
 

Attachment: i_LC_Header.pm
Description: Binary data

Reply via email to