Forum Replies Created
-
AuthorPosts
-
Hi Barry,
The Items.AddPair method is actually implemented in the VCL TStrings class and, as its name suggests, is used for adding name=value pairs separated by the ‘=’ sign. The TRzTabbedListBox uses the Tab character #9 as the delimiter, and also supports multiple tab-stops.
So, to add your items to the list box, you should do the following:tlbMatches.Items.Add( v + #9 + n );
Or, you can use the TRzCustomListBox shortcut of:
tlbMatches.Add( v + #9 + n );
Ray
You’re welcome. Happy to help
Ray
I reported this issue to Embarcadero: RSP-28164
Ray
Okay, digging a little deeper, there is definitely a change in the AquaGraphite VCL Style between XE8 and RX10. I loaded the AquaGraphite.vsf file from XE8 into the Bitmap Style Designer, and then I loaded the AquaGraphite.vsf file from RX10 into the Bitmap Style Designer.
You can clearly see the difference in the ListBox style. In the XE8 version, the list box background is simply black. However, when you look at the same ListBox style in the RX10 version of the AquaGraphite.vsf style you see that there is a glowing check mark right in the middle of the ListBox background. this is why you are seeing the “artifacts” in the widgets. The same checkmark appears in other style backgrounds as well.
The root cause of the problem lies in the source image “style.png” embedded in the style file. In the Bitmap Style Designer, you can clearly see that in RX10 or later, the style.png image has a black rectangle that has the check mark within the bounds of the rectangle. And this rectangle servers as the source image for many control types in the style.
So, to fix this, you can either select a different VCL Style, or you can try to modify the style (i.e. remove the check mark from the source image).
I would also suggest reporting this issue to Embarcadero, so that the style can be fixed for future releases.
Ray
Hi,
I can confirm that the problem first started appearing in RAD Studio 10 Seattle. In XE8 and earlier the VCL Styles appeared correctly. I still need to investigate whether there was a change in the components that is causing this, or a changing in the Style definition itself.
Ray
April 30, 2020 at 12:42 am in reply to: Codesite (Express) doesn’t work when called from a 64-bit application. #1788Hi Steven,
I apologize for the delay. I’ve been looking over old posts and emails to see if anything like this has been reported before. I vaguely recall something similar to what you are reporting, but was unable to locate anything concrete. I’ll keep looking.
In the meantime, what I suspect is happening is that when your 64-bit COM Dll is trying to send a CodeSite message (using the TCodeSiteLogger) to the Dispatcher, the default transport mechanism is getting blocked because by Windows. The default transport method between loggers and Dispatcher is WM_COPYDATA. Over the years, Microsoft keeps reducing the situations in which this message is allowed. For example, a service app runs in a different window station from the user’s desktop and WM_COPYDATA messages are not allowed to transport across window stations. I believe the same thing is happening between the 64-bit COM Dll and the 32-bit Dispatcher. There is no problem between 64-bit app and 32-bit Dispatcher.
I believe the solution to the 64-bit COM DLL situation is the same as logging from a service. That is, the transport method the loggers use needs to be changed to TCP. This is accomplished by calling the ConnectUsingTcp method before sending your first CodeSite message. We recommend calling ConnectUsingTcp on the CodeSiteManager, so that all CodeSite loggers will use the same connection method.
Ray
Hi,
Thanks for posting the screenshot. I was able to duplicate the effect you are seeing in a brand new project. My gut reaction is that something changed in the Aqua Graphite VCL Style, but I will need to investigate this more thoroughly to figure out just what is happening. Clearly something has changed in a recent release of VCL Styles because this most definitely did not happen before.
Ray
Hi,
I tried to duplicate the issue that you reported, but I was unable to do so. What version of Delphi are you using? Also, where exactly does the Nike symbol appear? It sounds like a missing font issue. Although, I would expect that the issue would be present even without selecting a VCL Style.
Ray
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,
RayHere is a screen shot of the button.
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.
Rayunit 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.
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 4 years, 7 months ago by Ray Konopka.
- This reply was modified 4 years, 7 months ago by Ray Konopka.
Hi Hans,
I am responding to your email regarding the same issues.Ray
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
March 18, 2020 at 7:57 pm in reply to: Delphi 10.3.3 Install Problems – can’t build w/Raize controls on form #1708Hi Ian,
Glad to hear you resolved the issue. Thanks for sharing the info regarding the AntiVirus software.
Ray
-
AuthorPosts