TRzListView Columns (missing headers)

Home Forums Konopka Signature VCL Controls (formerly Raize Components) TRzListView Columns (missing headers)

Viewing 13 reply threads
  • Author
    Posts
    • #3847
      Jeremy Praay
      Participant

        Create a Delphi Project with 2 forms (Form1, Form2).
        Set Visible to False on Form2.

        Project1.dpr should look like this:

        program Project1;

        uses
        Vcl.Forms,
        Vcl.Themes,
        Vcl.Styles,
        Unit1 in ‘Unit1.pas’ {Form1},
        Unit2 in ‘Unit2.pas’ {Form2};

        {$R *.res}

        begin
        Application.Initialize;
        Application.MainFormOnTaskbar := True;
        Application.CreateForm(TForm1, Form1);
        Application.CreateForm(TForm2, Form2);
        Application.Run;
        end.

        Put a TRzListView on Form2 and create column headers in it.
        Assign on OnClick event to Form1 with the following

        procedure TForm1.FormClick(Sender: TObject);
        begin
        Form2.Position := poMainFormCenter;
        Form2.ShowModal;
        end;

        Run the code, click the form, Form2 will not display the column headers.  This seems to be related to assigning the Form2.Position.  It also occurs if I change the FormStyle to fsStayOnTop, and perhaps some other things as well.  If that single line is removed, it will display correctly.  Also, the TListView component doesn’t appear to have this problem.

        Oddly, if I don’t use the “Windows” default for the Application Style, it seems to display correctly.  Also, this was fine until I installed Delphi 12 around mid November.  But now even if I compile in Delphi 11.3, the same problem appears.  I’m guessing that I upgraded both Delphi 11 and 12 to the latest version (7.0.0).

        Hopefully you can duplicate this issue.  It is currently holding up our application from being deployed.

        Thanks for your help!

      • #3848
        Jeremy Praay
        Participant

          I should mention that the RzListView1.ViewStyle should be set to vsReport, otherwise no columns display (by design). But hopefully that was obvious.

          Also, I just did a bit more poking around and discovered that it FillLastColumn is False, then it displays the columns. This appears to be a very old bug resurfacing. A work-around therefore appears to be setting FillLastColumn to False at design-time, then setting it to True at run-time. Not the greatest solution, but I can work with it for now.

        • #3849
          Jeremy Praay
          Participant

            …and after spending more time on this tonight, that workaround doesn’t work in all cases. 🙁

          • #3854
            Ray Konopka
            Keymaster

              Hi Jeremy,
              Unfortunately, I’ve been unable to duplicate the problem. Would you be able to send the source code to a sample project (no exes) to support@raize.com that demonstrates the issue?
              Ray

            • #3855
              Jeremy Praay
              Participant

                I will. I have found a handful of ways to duplicate the issue and also discovered that it’s NOT happening in 11.3 (I was mistaken) and it’s also not specifically related to the FillLastColumn property.

              • #3856
                Nick Klein
                Participant

                  It happens to me every time.  I am using Delphi 12 Patch 1 and KSVC 7.0.

                  Steps to reproduce:

                  1. Create a new VCL app.

                  2. Add a TRzSplitter to the form. I left all the properties as the defaults.

                  3. Add a RzListView into one of the splitter panes. I left all the properties as the defaults except for ViewStyle.

                  4. Set the RzListView ViewStyle as vsReport and define a couple of columns with text.

                  5. Run the program.  The column text appears in the designer, but not while running the program.

                  6. If the RzListView FillLastColumn property is set to False, the column heading text does appear when the program runs.  Note: I had to change it in the designer. Changing it at runtime had no effect.

                  Hope this helps.

                • #3858
                  Ray Konopka
                  Keymaster

                    For those following this thread. Jeremy did send me a sample project and I am able to duplicate the issue. I am working on a fix.

                    Ray

                  • #3917
                    Jeremy Praay
                    Participant

                      Just making sure you haven’t forgotten about us. 😉

                    • #3951
                      Anton Epifanov
                      Participant

                        Dear Ray, could you write when you can make a fix. When we can download it on GetIt.
                        Thanks.

                      • #3971
                        Jeremy Praay
                        Participant

                          I reported this issue to Embarcadero Quality Portal. Hopefully this link works for everyone:

                          https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-1735

                        • #4039
                          Jeremy Praay
                          Participant

                            For anyone following this, I found the following work-around / hack.  I’m sure that an actual fix could be created using this info, but this is what I have at the moment, and it works.

                            In RzListVw.pas (you’ll obviously need to compile using the modified file) inside the WMNCPaint procedure, add “ResetHeaderHandle;” just before the end of the routine.

                            e.g.

                            procedure TRzCustomListView.WMNCPaint( var Msg: TWMNCPaint );
                            var
                            DC: HDC;
                            begin
                            inherited;
                            .
                            .  —- procedure code omitted here —-
                            .
                            ResetHeaderHandle;
                            end;

                          • #4041
                            Ray Konopka
                            Keymaster

                              Hi Jeremy,
                              Thanks for sharing your findings. The solution that I came up with essentially does the same thing but instead of calling ResetHeaderHandle in the WMNCPaint method, I call it in the SetViewStyle method:

                              procedure TRzCustomListView.SetViewStyle( AValue: TViewStyle );
                              begin
                                if ( AValue <> ViewStyle ) then
                                begin
                                  inherited;
                                  if AValue = vsReport then
                                  begin
                                    SetHeaderODStyle;
                                    {$IFDEF RX12_OR_HIGHER}
                                    ResetHeaderHandle;
                                    {$ENDIF}
                                  end;
                                end;
                              end;

                              This way the header handle is reset only when the view style is changed as opposed to each time WMNCPaint is called.

                              Ray

                            • #4042
                              Ray Konopka
                              Keymaster

                                Hi Jeremy,
                                Thanks for sharing your findings. The solution that I came up with essentially does the same thing but instead of calling ResetHeaderHandle in the WMNCPaint method, I call it in the SetViewStyle method:

                                procedure TRzCustomListView.SetViewStyle( AValue: TViewStyle );
                                begin
                                  if ( AValue <> ViewStyle ) then
                                  begin
                                    inherited;
                                    if AValue = vsReport then
                                    begin
                                      SetHeaderODStyle;
                                      {$IFDEF RX12_OR_HIGHER}
                                      ResetHeaderHandle;
                                      {$ENDIF}
                                    end;
                                  end;
                                end;

                                This way the header handle is reset only when the view style is changed as opposed to each time WMNCPaint is called.

                                Ray

                              • #4043
                                Jeremy Praay
                                Participant

                                  Thanks Ray.  That fixed in the example I sent where the ViewStyle is changed, but this problem is also manifesting in other ways, and that didn’t fix those.

                                  In my code where this bug is manifesting, I don’t actually change the ViewStyle, but I do change the default position of the form.  In my initial example at the top of this thread, I programmatically set the form position to poMainFormCenter for the modal form (Form2) and then the column headers disappear …and this seems to function for me now (in Delphi 12.2).

                                  In the places where I am still seeing this issue, the TRzListView components are part of a TFrame.  Maybe that’s the difference?  I’m not sure as I haven’t tried to dig deeper into the issue once I found a “fix.”

                                  The WMNCPaint procedure may be a bigger hammer than is needed, but it seems to work in all cases.  I did (just now) add a check for “if ViewStyle = vsReport” though.

                              Viewing 13 reply threads
                              • You must be logged in to reply to this topic.