Ray Konopka

Forum Replies Created

Viewing 15 posts - 256 through 270 (of 343 total)
  • Author
    Posts
  • in reply to: TRzDBGrid AltRowShading Colours #1767
    Ray Konopka
    Keymaster

      Hi Barry,

      Unfortunately, this is another case where Embarcadero needs to allocate some resources to keep the KSVC updated. The display problem you are seeing is a result of the DrawingStyle property that was added to the TCommonGrid and thus TDBGrid, which is the ancestor of the TRzDBGrid. The default value of DrawingStyle is gdsThemed. If you change the property to gdsGradient or gdsClassic you will see that the highlighted rows are displayed correctly. If you use gdsGradient, the gradient colors of the fixed cells is controlled by the GradientStartColor and GradientEndColor properties. Set them to the same color and there is essentially no gradient. The selected row is shown as a gradient based on the system highlighted color (i.e. clHighlight).

      If changing the DrawingStyle will not work, then you have two options. The first is to draw the cells yourself. Set the DefaultDrawing property to False and then write an event handler for the OnDrawColumnCell event. For example,

      uses
        Vcl.Themes,
        RzCommon;
      
      procedure TForm16.RzDBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn;
        State: TGridDrawState);
      var
        Grid: TRzDBGrid;
        BrushColor, FontColor: TColor;
      begin
        Grid := Sender as TRzDBGrid;
      
        // Set the default colors
        BrushColor := clWindow;
        FontColor := clWindowText;
        if gdSelected in State then
        begin
          BrushColor := $00FFD199;
        end;
      
        if Grid.AltRowShading then
        begin
          if Column.Field.DataSet.RecNo mod 2 = 1 then
          begin
            if not ( gdSelected in State ) then
            begin
              BrushColor := Grid.AltRowShadingColor;
              FontColor := clWindowText;
            end;
          end;
        end;
      
        Grid.Canvas.Brush.Color := BrushColor;
        Grid.Canvas.Font.Color := FontColor;
        Grid.DefaultDrawColumnCell( Rect, DataCol, Column, State );
      end;

      The event handler takes care of setting the background (i.e. brush) and font colors and then uses the built-in DefaultDrawColumnCell method to actually do the drawing. The solution works, but it is a bit simplistic. For instance, the highlight color is hard coded. There are functions in the Style Services to get the various colors of a grid, but unfortunately, the TCommonGrid does NOT use them. Ugh. Instead, the base grid “draws” the grid cells from the active style. Unfortunately, do the same inside this event handler is not really an option.

      The second option is to modify the TRzDBGrid source code. Specifically, the TRzDBGrid.DrawColumnCell method. The fragment below contains the top portion of the method with comments indicating the lines to change.

      procedure TRzDBGrid.DrawColumnCell( const Rect: TRect; DataCol: Integer;
                                          Column: TColumn; State: TGridDrawState );
      var
        Success: Boolean;
        {$IFDEF VCL140_OR_HIGHER}
        S: string;
        {$ENDIF}
      begin
        // Set cell background color the right way before calling user event
        if FAltRowShading then
        begin
          if ( FAltRowShadingFixed and ( ( DataLink.ActiveRecord mod 2 ) = 0 ) ) or                // Scrolling background
             ( ( not FAltRowShadingFixed ) and ( ( Column.Field.DataSet.RecNo mod 2 ) = 1 ) ) then // Fixed background
          begin
            if HighlightCell( DataCol, DataLink.ActiveRecord, Column.Field.DisplayText, State ) then
            begin
              if DrawingStyle = gdsThemed then       // Add
                Canvas.Brush.Color := clWindow       // Add
              else                                   // Add
                Canvas.Brush.Color := clHighlight;   // Indent
            end
            else
            . . . 
      

      After making the change and saving the file, you can either add the RC6\Source directory to your project’s search path, or you can shutdown Delphi and using the !Build_RC6.cmd file in the Source directory to rebuild the components and packages. Either way, when you run the app, the highlighted bar will display correctly when DrawingStyle is set to gdsThemed.

      One note about the above code modification. It is certainly odd that setting the Canvas.Brush.Color to clWindow results in the correct highlight color being used. I discovered this rather by accident. Initially I tried using the Style Services functions I mentioned earlier to get the cell color for the grid, but all of the grid colors kept coming up clWindow (clWhite on my machine). However, with the color set to clWindow, the correct highlight color was displayed. But, if you use a different color, the highlight color changes. I believe this is due to the default style used for the grid uses a semi transparent color for the highlight color. When the base color is set to clWindow (i.e. clWhite) the highlight color matches exactly with the non-alt-shaded rows. A different base color results in a different highlight color.

      Hope this helps,
      Ray

      in reply to: TrzButton is vertical text possible? #1734
      Ray Konopka
      Keymaster

        Here is a screen shot of the button.

        in reply to: TrzButton is vertical text possible? #1733
        Ray Konopka
        Keymaster

          Hi,
          Unfortunately, the TRzButton does not support the same display capabilities as the TRzLabel. The TRzButton class does have a Draw3DText method that is virtual that does all the drawing of the text of the button. And the TRzLabel also has a Draw3DText method. So, in theory you should be able to override the Draw3DText method of TRzButton with the one from TRzLabel. Well, I decided to try that for fun. Turns out you can indeed do that, but there are several properties that are in TRzLabel that do not exist in TRzButton. So, I ended up making several assumptions to eliminate a lot of code. For example, I eliminated the 3D text features. I also removed the CenterPoint property from TRzLabel as well as the Rotation property, which controls whether the text is rotated flat or on a curve. The TRzLabelButton below just supports the flat rotation.
          The code below is for a form unit. Just create a new empty VCL project and then create a FormCreate event handler. Then simply copy the code from below into your form unit. You should then be able to run the program and see a button with rotated text.
          Ray

          
          unit Unit5;
          
          interface
          
          uses
            Winapi.Windows,
            Winapi.Messages,
            System.SysUtils,
            System.Variants,
            System.Classes,
            Vcl.Graphics,
            Vcl.Controls,
            Vcl.Forms,
            Vcl.Dialogs,
            Vcl.StdCtrls,
            RzButton,
            RzLabel;
          
          type
            TRzLabelButton = class( TRzButton )
            private
              FAngle: Integer;
              procedure SetAngle( Value: Integer );
            protected
              procedure Draw3DText( Canvas: TCanvas; R: TRect; Flags: DWord ); override;
            published
              property Angle: Integer
                read FAngle
                write SetAngle;
            end;
          
            TForm5 = class(TForm)
              procedure FormCreate(Sender: TObject);
            private
              B: TRzLabelButton;
            public
            end;
          
          var
            Form5: TForm5;
          
          implementation
          
          {$R *.dfm}
          
          uses
            Vcl.Themes,
            RzCommon;
          
          procedure TRzLabelButton.SetAngle( Value: Integer );
          begin
            if FAngle <> Value then
            begin
              if Value < 0 then
                FAngle := 360 - Abs( Value )
              else
                FAngle := Value mod 360;
          
              if not ( csLoading in ComponentState ) and
                 ( Value <> 0 ) and
                 not IsTrueTypeFont( Font ) then
              begin
                Font.Name := 'Verdana';  { Switch to Verdana if current font is not TrueType }
              end;
          
          //    if ( Angle <> 0 ) and ( FRotation = roNone ) then
          //      FRotation := roFlat;
          //    AdjustBounds;
              Repaint;
            end;
          end;
          
          procedure TRzLabelButton.Draw3DText( Canvas: TCanvas; R: TRect; Flags: DWord );
          const
            FShadowDepth = 2;
            WordWrap = False;
            ShowAccelChar = False;
          var
            TempRct: TRect;
            ULColor, LRColor: TColor;
            Center: TPoint;
            Radius, Rad: Extended;
            H, W: Integer;
            HalfShadow, ShadowOffset: Integer;
            TempAlignment: TAlignment;
          
            function TextAligned( A: DWord ): Boolean;
            begin
              Result := ( Flags and A ) = A;
            end;
          
          begin
            Canvas.Brush.Style := bsClear;
          
            HalfShadow := FShadowDepth div 2;
          
          //  FixClientRect( R, True );
          //  InflateRect( R, -FTextMargin, -FTextMargin );
          
            TempAlignment := Alignment;
            if UseRightToLeftAlignment then
              ChangeBiDiModeAlignment( TempAlignment );
          
            Flags := dt_ExpandTabs or DrawTextAlignments[ TempAlignment ];
          
            if TempAlignment = taRightJustify then
              Flags := Flags or dt_Right;
          
            if UseRightToLeftAlignment then
              Flags := Flags or dt_RtlReading;
          
            if WordWrap then
              Flags := Flags or dt_WordBreak;
          
            if not ShowAccelChar then
              Flags := Flags or dt_NoPrefix;
          
            Canvas.Font := Self.Font;
          
            Center := Point( Width div 2, Height div 2 );
          
            Rad := ( FAngle * Pi / 180 ) + ( Pi / 2 );
            Radius := Canvas.TextHeight( 'Pp' ) / 4;
          
            W := Canvas.TextWidth( Caption );
            H := Canvas.TextHeight( 'Pp' );
            ShadowOffset := 0;
          
            W := W + ShadowOffset;
            H := H + ShadowOffset;
          
            case FAngle of
              0, 360:
              begin
                if TextAligned( dt_Center ) then
                  SetTextAlign( Canvas.Handle, ta_Center )
                else if TextAligned( dt_Right ) then
                  Center.X := R.Right - W - ShadowOffset
                else
                  Center.X := R.Left + ShadowOffset;
                Center.Y := Center.Y - H div 2;
              end;
          
              90:
              begin
                Center.X := Center.X - Round( Radius * Cos( Rad ) );
                if TextAligned( dt_Center ) then
                  Center.Y := R.Bottom - ( R.Bottom - W ) div 2
                else if TextAligned( dt_Right ) then
                  Center.Y := R.Top + W + ShadowOffset
                else
                  Center.Y := R.Bottom - ShadowOffset;
                SetTextAlign( Canvas.Handle, ta_Left or ta_Baseline );
              end;
          
              180:
              begin
                if TextAligned( dt_Center ) then
                  Center.X := R.Right - ( R.Right - W ) div 2
                else if TextAligned( dt_Right ) then
                  Center.X := R.Left + W
                else
                  Center.X := R.Right - ShadowOffset;
                Center.Y := Center.Y - ( H div 4 );
                SetTextAlign( Canvas.Handle, ta_Left or ta_Baseline );
              end;
          
              270:
              begin
                Center.X := Center.X - Round( Radius * Cos( Rad ) );
                if TextAligned( dt_Center ) then
                  Center.Y := ( R.Bottom - W ) div 2
                else if TextAligned( dt_Right ) then
                  Center.Y := R.Bottom - W - ShadowOffset
                else
                  Center.Y := R.Left + ShadowOffset;
                SetTextAlign( Canvas.Handle, ta_Left or ta_Baseline );
              end;
          
              else
              begin
                Center.X := Center.X - Round( Radius * Cos( Rad ) );
                Center.Y := Center.Y + Round( Radius * Sin( Rad ) );
                SetTextAlign( Canvas.Handle, ta_Center or ta_Baseline );
              end;
            end; { case }
          
            Canvas.Font.Handle := RotateFont( Self.Font, FAngle );
          
            TempRct := R;
            if Enabled then
            begin
              if ActiveStyleServicesEnabled and not UsingSystemStyle then
                Canvas.Font.Color := ActiveStyleFontColor( sfTextLabelNormal )
              else
                Canvas.Font.Color := Font.Color;
          
              Canvas.TextRect( TempRct, Center.X, Center.Y, Caption )
          
            end
            else { if not Enabled }
            begin
              if UsingSystemStyle then
                Canvas.Font.Color := clGrayText
              else
                Canvas.Font.Color := ActiveStyleFontColor( sfWindowTextDisabled );
          
              Canvas.TextRect( TempRct, Center.X, Center.Y, Caption );
            end;
          end;
          
          procedure TForm5.FormCreate(Sender: TObject);
          begin
            B := TRzLabelButton.Create( Self );
            B.Parent := Self;
            B.SetBounds( 50, 50, 50, 200 );
            B.Angle := 90;
            B.Caption := 'Rotated Text';
          end;
          
          end.
          in reply to: CodeSite.SendSystemInfo Missing Fields #1723
          Ray Konopka
          Keymaster

            Hi Steve,

            Thanks for taking the time to report this issue. This issue was fixed in version 5.3.3.

            Ray

            • This reply was modified 6 years, 1 month ago by Ray Konopka.
            • This reply was modified 6 years, 1 month ago by Ray Konopka.
            in reply to: CodeSite Dispatcher: Out of memory #1722
            Ray Konopka
            Keymaster

              Hi Hans,
              I am responding to your email regarding the same issues.

              Ray

              in reply to: TRzAnimate ActivityIndicator doesn’t show #1714
              Ray Konopka
              Keymaster

                No problem. However, I’ll still post my response 🙂

                The TRzAnimator component is a user interface control. As such, if your perform some other process in the main UI thread that is computationally intensive, then it is possible for UI controls to not display correctly. There are a couple ways around that–typically creating a background thread to do the work leaving the UI thread free to update.

                Now, if the animation is not appearing at all, then that could be some other issue.

                Ray

                Ray Konopka
                Keymaster

                  Hi Ian,

                  Glad to hear you resolved the issue. Thanks for sharing the info regarding the AntiVirus software.

                  Ray

                  in reply to: CodeSite Dispatcher: Out of memory #1707
                  Ray Konopka
                  Keymaster

                    Hi,

                    Is there anyway that you can get access to the machine? Or at least have a user access the Dispatcher Log on that machine?

                    If the disk was getting so full that the Dispatcher was unable to update the log file, then the Dispatcher should record the error in the Dispatcher Log and then continue to process the next message. The next message would then have a problem as well, log the problem, and continue. Clearly the Out of Memory error suggests that something is not getting cleaned up correctly in this situation.

                    In addition to check the Dispatcher Log, I would suggest terminating the CSDispatcher.exe and then check the hard disk. Is the disk really full? Or, was the CSDispatcher just eating memory.

                    Finally, do you know what version of the CodeSite Dispatcher is running on that machine?

                    Ray

                    Ray Konopka
                    Keymaster

                      Hi Ian,

                      I suspect that the root cause of the problem may lie in how you have 10.3 configured. I have 10.3.3 installed and am using the KSVC (installed via GetIt) without any of the problems that you are reported. Also, the fact that you have also been having issues with other libraries makes me believe there might be something wrong in the IDE config.

                      When you posted “If I drop them on the form…”, as this form part of an existing project? Or a brand new VCL project?

                      The F2063 compiler error usually means that you have a directory on your Library Search path that already has *.dcu files for the referenced units, but they were built with an old version of Delphi. So, I would check all the directories on your Library Search Path and see if there are some Rz*.dcu files located on any of them. I would also check the directories of the project you are trying to compile. If you find any Rz*.dcu, I suspect that these were added by the compiler. Normally, this should not happen, but it would happen if you added the Raize Components Source directory to your project at some point so the component units would get rebuilt by the compiler.

                      Hope this helps,
                      Ray

                      in reply to: TrzButtonEdit ignores StyleElements #1701
                      Ray Konopka
                      Keymaster

                        Unfortunately, supporting StyleElements throughout the library is something that I have wanted Embarcadero to tackle since acquiring the components. Unfortunately, the appearance of the TRzControlButton (i.e. the class that controls the embedded buttons) is handled in the TRzControlButton.DrawBtnFace method and that method does not look at StyleElements nor is there a UseThemes type property available either.

                        Ray

                        in reply to: acc violation in TRzCheckGroup #1693
                        Ray Konopka
                        Keymaster

                          Hi,

                          I created a test project and I am unable to duplicate the issue you are reporting. I dropped a TRzCheckGroup and two buttons on the form. In the first button, I added several items to the check group. In the second button I clear the check group. I then ran the app and loaded the items, checked some items, and clicked the second button to clear the group. No issues.

                          I am wondering if you have any other interactions going on in your project? Are you able to duplicate the issue in a test project? If so, please send the source (no exes) to support@raize.com and I’ll take a look.

                          Ray

                          in reply to: Search through lots of log files #1685
                          Ray Konopka
                          Keymaster

                            Hi Hans,

                            I’m so glad to hear that the CSSearchFiles tool helped you locate what you were looking for more quickly. And thank you for bringing up your request on this forum. I love to hear how people are using (or would like to use) CodeSite. You never know when it may spark a new feature or supporting tool!

                            Ray

                            in reply to: Search through lots of log files #1667
                            Ray Konopka
                            Keymaster

                              Hi,

                              The new CSSearchFiles command line tool is now available:
                              https://raize.com/wp-content/uploads/CSSearchFiles.zip

                              The usage information for CSSearchFiles is shown below. Running CSSearchFile.exe without any command line parameters will also display the usage information.

                              Remember that the message number displayed next to each match can be used to jump directly to that message while in the CodeSite Live Viewer or CodeSite File Viewer.

                              Ray

                              CodeSite Search Files 5.3.3
                              Copyright (c) 1998-2018 by Raize Software, Inc.  All Rights Reserved.
                              
                              Usage:
                                CSSearchFiles [-type:<MsgTypes>] [-text:<Text>] [-trim:<Columns>] <Files>
                              
                                MsgTypes:  Search for specified message types (e.g. EX)
                                           N=Notes | W=Warnings | E=Errors | X=Exceptions
                              
                                Text:      If search text includes spaces, wrap in double quotes
                                Columns:   Trim output to column width (e.g. 80)
                                Files:     Path to CodeSite file(s) to search (e.g. C:\Logs\*.csl)
                              
                              Examples:
                              
                              CSSearchFiles -type:EX *.csl
                                Search for all Error and Exception messages in all CodeSite log files
                                in the current directory
                              
                              CSSearchFiles -text:"Print Report" *.csl
                                  Search for all messages that contain "Print Report" in message text
                              in reply to: RC6 with Delphi 10 Seattle #1665
                              Ray Konopka
                              Keymaster

                                Hi,

                                Unfortunately, Delphi 10 Seattle support was added to the components after Embarcadero acquired the components from us. Also, complicating matters is that with the initial release of Delphi 10 Seattle, Embarcadero began selling the components as a subscription. Eventually, Embarcadero stopped selling the components and made them available to all RAD Studio users–starting with Delphi 10.1 Berlin.

                                Things got even easier with the release of Delphi 10.2 Tokyo and Delphi 10.3 Rio where the Konopka Signature VCL Controls are available in the GetIt Package Manager.

                                If you have to use Delphi 10 Seattle, then I’m afraid you will need to contact Embarcadero about getting access to the components.

                                Ray

                                in reply to: Search through lots of log files #1660
                                Ray Konopka
                                Keymaster

                                  Hi Hans,

                                  At first I was going to suggest the CSMergeFiles tool to combine all your logs into one (or a few) log files, but then I realized that the CSMergeFiles tools works by taking two log files and creating a merged log file. Combining 300+ log files would be nearly as tedious as loading each one into the viewer.

                                  This gave me an idea–a new command line tool called CSSearchFiles where you specify a log filename or a wildcard along with what types of messages you are looking for (e.g. Warnings, Errors, Exceptions, Notes) and the tools rips through each of the log files that match the file mask and writes on the console any matches including the message number. Then load the corresponding log file into the viewer and select Search > Jump to Message and enter the message number from the output.

                                  The tool is working, but I need to do a little bit more to polish it up. I’ll make the tool available in the next day or two. Here’s a screenshot of the current version.

                                  Ray

                                  CSSearchFiles.png

                                  • This reply was modified 6 years, 1 month ago by Ray Konopka.
                                Viewing 15 posts - 256 through 270 (of 343 total)