Missing Caption Underscores in TButton, TBitBtn, TCheckBox when Called From Desktop in W7-32/XP
Original Reporter info from Mantis: GraySpottedOwl
-
Reporter name: Gary Allen Wiltshire
Original Reporter info from Mantis: GraySpottedOwl
- Reporter name: Gary Allen Wiltshire
Description:
If one starts any program with a TButton, TBitBtn or TCheckBox with a caption containing an ampersand in their respective captions the underscores are not shown as long as the program was started from a desktop icon. If the program is started from the command line the underscores are properly presented! This applies to Windows XP and 7-32 while the underscores are properly displayed in Windows ME. Furthermore, an outside program starting such a program with CreateProcess works properly, displaying all underscores, while a program triggering with ShellExecute does not. By contrast a TLabel works properly in any case.
Steps to reproduce:
Create a project from the attached three files. Run resulting program in XP or higher from a desktop icon versus the command line. The behavior seems to be consistent on different machines.
Additional information:
(****** AMPERSAND.LPR ******)
program ampersand;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
(****** UNIT1.LFM ******)
object Form1: TForm1
Left = 307
Height = 126
Top = 170
Width = 220
BorderStyle = bsSingle
Caption = 'Ampersand'
ClientHeight = 126
ClientWidth = 220
KeyPreview = True
OnKeyDown = FormKeyDown
Position = poScreenCenter
LCLVersion = '0.9.31'
object Button1: TButton
Left = 8
Height = 25
Top = 8
Width = 75
Caption = '&A - TButton'
OnClick = Button1Click
TabOrder = 0
end
object CheckBox1: TCheckBox
Left = 10
Height = 19
Top = 40
Width = 97
Caption = '&B - TCheckBox'
OnClick = Button1Click
TabOrder = 1
end
object BitBtn1: TBitBtn
Left = 10
Height = 30
Top = 64
Width = 75
Caption = '&C - TBitBtn'
OnClick = Button1Click
TabOrder = 2
end
object Label1: TLabel
Left = 10
Height = 16
Top = 104
Width = 55
Caption = '&D - TLabel'
ParentColor = False
OnClick = Button1Click
end
end
(****** UNIT1.PAS ******)
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Windows,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons;
type
{ TForm1 }
TForm1 = class(TForm)
BitBtn1: TBitBtn;
Button1: TButton;
CheckBox1: TCheckBox;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Caption := (Sender as TControl).Caption
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
);
begin
if Key = VK_D then
begin
Key := 0;
Caption := Label1.Caption
end;
end;
end.
Mantis conversion info:
- Mantis ID: 19333
- OS: Windows
- OS Build: 7 / XP / ME
- Build: 20110510
- Platform: Toshiba NB505 / Dell Dimension
- Version: 2.3 (SVN)