I Have a Simple popup menu in a vcl application , but there is something weird happened when i write non-latin characters into the popup-menu Caption
the characters written correctly but it has this extra characters added (Z) at the end of the caption. this characters only added when i type non-latin words into the caption , English words shows correctly .
here is the dfm of the test project
object Form1: TForm1
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
Caption = 'Form1'
ClientHeight = 242
ClientWidth = 472
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PopupMenu = PopupMenu1
PixelsPerInch = 96
TextHeight = 13
object PopupMenu1: TPopupMenu
Left = 232
Top = 128
object N1: TMenuItem
Caption = #1575#1604#1604#1594#1577' '#1575#1604#1593#1585#1576#1610#1577
end
end
end
and this is an image of how the result comes out . this extra (Z) i did not write it into the caption at all . i don't know why its showing any idea why ?
TPopupMenu tries to automatically set a hotkey for each menu item (if you didn't do this manually by using & char). You can change your PopupMenu.AutoHotkeys property value to maManual if you want to avoid this behaviour.
Related
Delphi 11.1 Windows application, suddenly my TButtons with images are not displaying the images. They normally don't display in debug mode, but now they're not showing in release mode.
These are TButton components with TImageList assigned and ImageIndex value assigned. I have several TBitBtn components that are displaying properly.
First screenshot shows TButton with miscButtons chosen as images and ImageIndex 16. The image shows in IDE. Second screenshot is running the application. I already changed Go To Activity to TSpeedButton, so the image is working.
object btnReqNewActivity: TButton
Left = 141
Top = 454
Width = 175
Height = 40
Caption = 'Request NEW Activity'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ImageIndex = 16
ImageMargins.Left = 5
Images = miscButtons
ParentFont = False
TabOrder = 1
OnClick = btnReqNewActivityClick
end
object btnExportClassicList: TButton
Left = 333
Top = 454
Width = 78
Height = 40
Caption = 'Export'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
ImageIndex = 4
ImageMargins.Left = 5
Images = miscButtons
ParentFont = False
TabOrder = 2
OnClick = btnExportClassicListClick
end
I created a PNG image with photoshop: a simple shape with a drop shadow. Then I put it in a TImage under Delphi 2007 (dependency: PNG library called "PngComponents"). Execution on Windows XP produces almost the expected result (background is Delphi IDE):
But on Windows 10 there's a black frame instead of the shadow:
Not tested on W7/W8 but I guess that I could get the same problem. Here is the dfm content:
object frmSplashScreen: TfrmSplashScreen
Left = 517
Top = 321
AlphaBlendValue = 0
AutoSize = True
BorderStyle = bsNone
ClientHeight = 392
ClientWidth = 528
Color = clBtnFace
TransparentColorValue = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Default'
Font.Style = []
FormStyle = fsStayOnTop
KeyPreview = True
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object imgLogo: TImage
Left = 0
Top = 0
Width = 528
Height = 392
AutoSize = True
Picture.Data = {44A(...)E426082}
Transparent = True
end
end
What's wrong with my image and/or settings?
I said that result on XP was almost the one expected: indeed if I change the background of the form (ie minimize the window under the splashscreen), well the transparent part of the image isn't refreshed:
I use Delphi XE and I want to make a standard ListView behave and look like I want it.
I want the listview to be vsReport so I can have Groups for my items.
At design time I created the columns (one column named Topic), two groups, and a few items for each group.
At design time the ListView looks great, but at runtime, my first group is somehow partially hidden under the column caption. Here are the images:
At designtime:
At runtime:
and here is my DFM
object Form2: TForm2
Left = 326
Top = 150
Caption = 'Form2'
ClientHeight = 636
ClientWidth = 1289
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ListView1: TListView
Left = 0
Top = 0
Width = 205
Height = 636
Align = alLeft
Columns = <
item
Caption = 'Topic'
Width = 200
end>
ColumnClick = False
DoubleBuffered = True
FullDrag = True
Groups = <
item
Header = 'First group'
GroupID = 0
State = []
HeaderAlign = taLeftJustify
FooterAlign = taLeftJustify
Subtitle = 'Options bellow'
TitleImage = 1
end
item
Header = 'Settings'
GroupID = 1
State = [lgsNormal]
HeaderAlign = taLeftJustify
FooterAlign = taLeftJustify
Subtitle = 'Other options here'
TitleImage = 0
end>
HideSelection = False
HotTrack = True
HotTrackStyles = [htUnderlineCold, htUnderlineHot]
Items.ItemData = {
059E000000030000000000000000000000FFFFFFFF0000000000000000000000
000A4600690072007300740020006900740065006D000100000001000000FFFF
FFFF0000000000000000000000000B5300650063006F006E0064002000690074
0065006D000200000002000000FFFFFFFF000000000100000000000000134600
69007300720074002000730065007400740069006E0067007300200069007400
65006D00}
GroupView = True
RowSelect = True
ParentDoubleBuffered = False
ShowWorkAreas = True
TabOrder = 0
ViewStyle = vsReport
OnClick = ListView1Click
ExplicitTop = 8
ExplicitHeight = 497
end
end
How do I prevent this from happening?
This behaviour is present even in Delphi 10 Seattle. I'm not sure what causes it but you can work around it by making a significant change to the list view properties, and then reverting that change. That seems to be enough to get the list view to catch up. For instance, this will suffice:
procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.ViewStyle := vsIcon;
ListView1.ViewStyle := vsReport;
end;
But that's somewhat over the top. Digging in to what effect this code has, the key thing it does it to recreate the window. Which can be done like this:
type
TProtectedHackListView = class(TListView);
procedure TForm1.FormCreate(Sender: TObject);
begin
TProtectedHackListView(ListView1).RecreateWnd;
end;
Or even recreating the form, which in turn will recreate the children:
procedure TForm1.FormCreate(Sender: TObject);
begin
RecreateWnd;
end;
(And what can I do about it?)
If I create two labels in VCL and set one to use Arial and another Arial Narrow I'll see an expected result.
If I do the same in Firemonkey, the second label is not displayed in Arial Narrow. It is even not displayed in Arial (dots on i's are round, shape of 's' is all wrong etc.).
Does anybody know why FM (I was testing this with Delphi XE4) is not displaying the font properly? Is there anything I can do about it?
Source for the VCL form:
object Form3: TForm3
Left = 0
Top = 0
Caption = 'Form3'
ClientHeight = 198
ClientWidth = 475
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 32
Width = 134
Height = 14
Caption = 'This label is using Arial #11'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
end
object Label2: TLabel
Left = 24
Top = 52
Width = 152
Height = 15
Caption = 'This label is using Arial Narrow #11'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Arial Narrow'
Font.Style = []
ParentFont = False
end
object Label3: TLabel
Left = 24
Top = 98
Width = 398
Height = 36
Caption = 'This label is using Arial #32'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
end
object Label4: TLabel
Left = 24
Top = 140
Width = 429
Height = 37
Caption = 'This label is using Arial Narrow #32'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -32
Font.Name = 'Arial Narrow'
Font.Style = []
ParentFont = False
end
end
Source for the FM form:
object Form4: TForm4
Left = 0
Top = 0
Caption = 'Form4'
ClientHeight = 207
ClientWidth = 558
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [dkDesktop, dkiPhone, dkiPad]
DesignerMobile = False
DesignerWidth = 0
DesignerHeight = 0
DesignerDeviceName = ''
DesignerOrientation = 0
object Label1: TLabel
Font.Family = 'Arial'
StyledSettings = [ssSize, ssStyle, ssFontColor]
Height = 17.000000000000000000
Position.X = 16.000000000000000000
Position.Y = 32.000000000000000000
Text = 'This label is using Arial #11'
Width = 225.000000000000000000
end
object Label2: TLabel
Font.Family = 'Arial Narrow'
StyledSettings = [ssSize, ssStyle, ssFontColor]
Height = 17.000000000000000000
Position.X = 16.000000000000000000
Position.Y = 48.000000000000000000
Text = 'This label is using Arial Narrow #11'
Width = 225.000000000000000000
end
object Label3: TLabel
Font.Family = 'Arial'
Font.Size = 32.000000000000000000
StyledSettings = [ssStyle, ssFontColor]
Height = 41.000000000000000000
Position.X = 16.000000000000000000
Position.Y = 104.000000000000000000
Text = 'This label is using Arial #32'
Width = 433.000000000000000000
end
object Label4: TLabel
Font.Family = 'Arial Narrow'
Font.Size = 32.000000000000000000
StyledSettings = [ssStyle, ssFontColor]
Height = 65.000000000000000000
Position.X = 16.000000000000000000
Position.Y = 128.000000000000000000
Text = 'This label is using Arial Narrow #32'
Width = 545.000000000000000000
end
end
This seems to only affect fonts within families - if the font does not exist in the fonts folder under its own family name. Arial Narrow, for example, is a font within the "Arial" font file (it exists within a family and is not, per se, a family unto itself).
Typically a font family would include the four styles only
Arial (naively contains)
Arial Regular
Arial Bold
Arial Italic
Arial Bold Italic
"Arial Narrow", however, exists within the "Arial" family alongside the standard styles - ie :
Arial (actually contains)
Arial Regular
Arial Bold
Arial Italic
Arial Bold Italic
Arial Narrow
Arial Narrow Bold
Arial Narrow Italic
Arial Narrow Bold Italic
Arial Black
It seems that FMX is only looking one level deep within any given font family and is not looking at any style variant that deviates from the strict GDI+ style definitions (Regular, Bold, Italic, Bold Italic).
This also, by inspection, affects Arial Black - other examples are easy to find by running through your fonts folder. Franklin Gothic Demi, Gill Sans Ultra Bold, etc... anything that follows the above pattern. The font seems to be rendered in the default Segoe UI when these fonts are encountered.
A stopgap solution is to use Arial and set the Scale property to X=0.82 - it's not perfect, but it's quite close to Arial Narrow.
This is probably a bug and should be QC'd.
When you right click on a Delphi form you get the popup context menu. The bottom option is Text DFM. This option can either be checked or not checked. What does it mean when this option is checked or unchecked?
This option is used to select the format used to save your form (in binary or text format).
If you use the text DFM option, the form (dfm file) will be stored in a text format like so
object Form1: TForm1
Left = 451
Top = 290
Caption = 'Form38'
ClientHeight = 300
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
end