mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:59:14 +02:00
adds shortcut (mnemonic) support for toolbar buttons, initial focus in the evaluate dialog from Ere Maijala
git-svn-id: trunk@8157 -
This commit is contained in:
parent
ce972bc35b
commit
04442df12c
@ -1,15 +1,44 @@
|
||||
object EvaluateDlg: TEvaluateDlg
|
||||
ActiveControl = ToolBar1
|
||||
BorderStyle = bsSizeToolWin
|
||||
Caption = 'Evaluate/Modify'
|
||||
ClientHeight = 296
|
||||
ClientWidth = 400
|
||||
PixelsPerInch = 90
|
||||
HorzScrollBar.Page = 401
|
||||
VertScrollBar.Page = 297
|
||||
PixelsPerInch = 112
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 295
|
||||
Left = 351
|
||||
Height = 296
|
||||
Top = 136
|
||||
Width = 400
|
||||
object Label1: TLabel
|
||||
Caption = '&Expression:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 56
|
||||
Width = 74
|
||||
end
|
||||
object Label2: TLabel
|
||||
Caption = '&Result:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 104
|
||||
Width = 47
|
||||
end
|
||||
object lblNewValue: TLabel
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = '&New value:'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 248
|
||||
Width = 73
|
||||
end
|
||||
object ToolBar1: TToolBar
|
||||
AutoSize = True
|
||||
ButtonHeight = 50
|
||||
@ -17,18 +46,18 @@ object EvaluateDlg: TEvaluateDlg
|
||||
Caption = 'ToolBar1'
|
||||
EdgeBorders = [ebTop, ebBottom]
|
||||
Flat = True
|
||||
Height = 52
|
||||
ParentColor = True
|
||||
Height = 54
|
||||
ShowCaptions = True
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
Height = 52
|
||||
Height = 54
|
||||
Width = 400
|
||||
object tbInspect: TToolButton
|
||||
Caption = '&Inspect'
|
||||
Enabled = False
|
||||
Left = 226
|
||||
Height = 50
|
||||
Top = 2
|
||||
Width = 75
|
||||
end
|
||||
object tbWatch: TToolButton
|
||||
@ -37,6 +66,7 @@ object EvaluateDlg: TEvaluateDlg
|
||||
OnClick = tbWatchClick
|
||||
Left = 151
|
||||
Height = 50
|
||||
Top = 2
|
||||
Width = 75
|
||||
end
|
||||
object tbModify: TToolButton
|
||||
@ -44,60 +74,42 @@ object EvaluateDlg: TEvaluateDlg
|
||||
Enabled = False
|
||||
Left = 76
|
||||
Height = 50
|
||||
Top = 2
|
||||
Width = 75
|
||||
end
|
||||
object tbEvaluate: TToolButton
|
||||
Caption = 'E&valuate'
|
||||
Enabled = False
|
||||
OnClick = tbEvaluateClick
|
||||
Left = 1
|
||||
Height = 50
|
||||
Top = 2
|
||||
Width = 75
|
||||
end
|
||||
end
|
||||
object Label1: TLabel
|
||||
Caption = '&Expression:'
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 56
|
||||
Width = 65
|
||||
end
|
||||
object cmbExpression: TComboBox
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
MaxLength = 0
|
||||
OnChange = cmbExpressionChange
|
||||
OnKeyDown = cmbExpressionKeyDown
|
||||
TabOrder = 2
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 72
|
||||
Width = 384
|
||||
end
|
||||
object Label2: TLabel
|
||||
Caption = '&Result:'
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 104
|
||||
Width = 65
|
||||
end
|
||||
object txtResult: TMemo
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
TabOrder = 4
|
||||
TabOrder = 1
|
||||
Left = 8
|
||||
Height = 124
|
||||
Top = 120
|
||||
Width = 384
|
||||
end
|
||||
object lblNewValue: TLabel
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = '&New value:'
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 248
|
||||
Width = 65
|
||||
end
|
||||
object cmbNewValue: TComboBox
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
MaxLength = 0
|
||||
TabOrder = 6
|
||||
TabOrder = 3
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 264
|
||||
|
@ -1,32 +1,34 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TEvaluateDlg','FORMDATA',[
|
||||
'TPF0'#12'TEvaluateDlg'#11'EvaluateDlg'#11'BorderStyle'#7#13'bsSizeToolWin'#7
|
||||
+'Caption'#6#15'Evaluate/Modify'#12'ClientHeight'#3'('#1#11'ClientWidth'#3#144
|
||||
+#1#13'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3#145#1#18'VertScrollBar.Pa'
|
||||
+'ge'#3')'#1#4'Left'#3'_'#1#6'Height'#3'('#1#3'Top'#3#136#0#5'Width'#3#144#1#0
|
||||
+#8'TToolBar'#8'ToolBar1'#8'AutoSize'#9#12'ButtonHeight'#2'2'#11'ButtonWidth'
|
||||
+#2'K'#7'Caption'#6#8'ToolBar1'#11'EdgeBorders'#11#5'ebTop'#8'ebBottom'#0#4'F'
|
||||
+'lat'#9#6'Height'#2'4'#11'ParentColor'#9#12'ShowCaptions'#9#8'TabOrder'#2#0#7
|
||||
+'TabStop'#9#6'Height'#2'4'#5'Width'#3#144#1#0#11'TToolButton'#9'tbInspect'#7
|
||||
+'Caption'#6#8'&Inspect'#7'Enabled'#8#4'Left'#3#226#0#6'Height'#2'2'#5'Width'
|
||||
+#2'K'#0#0#11'TToolButton'#7'tbWatch'#7'Caption'#6#6'&Watch'#7'Enabled'#8#7'O'
|
||||
+'nClick'#7#12'tbWatchClick'#4'Left'#3#151#0#6'Height'#2'2'#5'Width'#2'K'#0#0
|
||||
+#11'TToolButton'#8'tbModify'#7'Caption'#6#7'&Modify'#7'Enabled'#8#4'Left'#2
|
||||
+'L'#6'Height'#2'2'#5'Width'#2'K'#0#0#11'TToolButton'#10'tbEvaluate'#7'Captio'
|
||||
+'n'#6#9'E&valuate'#7'Enabled'#8#7'OnClick'#7#15'tbEvaluateClick'#6'Height'#2
|
||||
+'2'#5'Width'#2'K'#0#0#0#6'TLabel'#6'Label1'#7'Caption'#6#12'&Expression:'#4
|
||||
+'Left'#2#8#6'Height'#2#17#3'Top'#2'8'#5'Width'#2'A'#0#0#9'TComboBox'#13'cmbE'
|
||||
+'xpression'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#9'MaxLength'#2#0#8
|
||||
+'OnChange'#7#19'cmbExpressionChange'#8'TabOrder'#2#2#4'Left'#2#8#6'Height'#2
|
||||
+#25#3'Top'#2'H'#5'Width'#3#128#1#0#0#6'TLabel'#6'Label2'#7'Caption'#6#8'&Res'
|
||||
+'ult:'#4'Left'#2#8#6'Height'#2#17#3'Top'#2'h'#5'Width'#2'A'#0#0#5'TMemo'#9't'
|
||||
+'xtResult'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOr'
|
||||
+'der'#2#4#4'Left'#2#8#6'Height'#2'|'#3'Top'#2'x'#5'Width'#3#128#1#0#0#6'TLab'
|
||||
+'el'#11'lblNewValue'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#11'&'
|
||||
+'New value:'#4'Left'#2#8#6'Height'#2#13#3'Top'#3#248#0#5'Width'#2'A'#0#0#9'T'
|
||||
+'ComboBox'#11'cmbNewValue'#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#9
|
||||
+'MaxLength'#2#0#8'TabOrder'#2#6#4'Left'#2#8#6'Height'#2#25#3'Top'#3#8#1#5'Wi'
|
||||
+'dth'#3#128#1#0#0#10'TImageList'#10'ImageList1'#4'left'#2#16#3'top'#3'`'#1#0
|
||||
+#0#0
|
||||
'TPF0'#12'TEvaluateDlg'#11'EvaluateDlg'#13'ActiveControl'#7#8'ToolBar1'#11'Bo'
|
||||
+'rderStyle'#7#13'bsSizeToolWin'#7'Caption'#6#15'Evaluate/Modify'#12'ClientHe'
|
||||
+'ight'#3'('#1#11'ClientWidth'#3#144#1#13'PixelsPerInch'#2'p'#18'HorzScrollBa'
|
||||
+'r.Page'#3#143#1#18'VertScrollBar.Page'#3''''#1#4'Left'#3'_'#1#6'Height'#3'('
|
||||
+#1#3'Top'#3#136#0#5'Width'#3#144#1#0#6'TLabel'#6'Label1'#7'Caption'#6#12'&Ex'
|
||||
+'pression:'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#8#6'Height'#2#13
|
||||
+#3'Top'#2'8'#5'Width'#2'J'#0#0#6'TLabel'#6'Label2'#7'Caption'#6#8'&Result:'#5
|
||||
+'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#8#6'Height'#2#13#3'Top'#2'h'
|
||||
+#5'Width'#2'/'#0#0#6'TLabel'#11'lblNewValue'#7'Anchors'#11#6'akLeft'#8'akBot'
|
||||
+'tom'#0#7'Caption'#6#11'&New value:'#5'Color'#7#6'clNone'#11'ParentColor'#8#4
|
||||
+'Left'#2#8#6'Height'#2#13#3'Top'#3#248#0#5'Width'#2'I'#0#0#8'TToolBar'#8'Too'
|
||||
+'lBar1'#8'AutoSize'#9#12'ButtonHeight'#2'2'#11'ButtonWidth'#2'K'#7'Caption'#6
|
||||
+#8'ToolBar1'#11'EdgeBorders'#11#5'ebTop'#8'ebBottom'#0#4'Flat'#9#6'Height'#2
|
||||
+'6'#12'ShowCaptions'#9#8'TabOrder'#2#0#7'TabStop'#9#6'Height'#2'6'#5'Width'#3
|
||||
+#144#1#0#11'TToolButton'#9'tbInspect'#7'Caption'#6#8'&Inspect'#7'Enabled'#8#4
|
||||
+'Left'#3#226#0#6'Height'#2'2'#3'Top'#2#2#5'Width'#2'K'#0#0#11'TToolButton'#7
|
||||
+'tbWatch'#7'Caption'#6#6'&Watch'#7'Enabled'#8#7'OnClick'#7#12'tbWatchClick'#4
|
||||
+'Left'#3#151#0#6'Height'#2'2'#3'Top'#2#2#5'Width'#2'K'#0#0#11'TToolButton'#8
|
||||
+'tbModify'#7'Caption'#6#7'&Modify'#7'Enabled'#8#4'Left'#2'L'#6'Height'#2'2'#3
|
||||
+'Top'#2#2#5'Width'#2'K'#0#0#11'TToolButton'#10'tbEvaluate'#7'Caption'#6#9'E&'
|
||||
+'valuate'#7'Enabled'#8#7'OnClick'#7#15'tbEvaluateClick'#4'Left'#2#1#6'Height'
|
||||
+#2'2'#3'Top'#2#2#5'Width'#2'K'#0#0#0#9'TComboBox'#13'cmbExpression'#7'Anchor'
|
||||
+'s'#11#5'akTop'#6'akLeft'#7'akRight'#0#9'MaxLength'#2#0#8'OnChange'#7#19'cmb'
|
||||
+'ExpressionChange'#9'OnKeyDown'#7#20'cmbExpressionKeyDown'#8'TabOrder'#2#2#4
|
||||
+'Left'#2#8#6'Height'#2#25#3'Top'#2'H'#5'Width'#3#128#1#0#0#5'TMemo'#9'txtRes'
|
||||
+'ult'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2
|
||||
+#1#4'Left'#2#8#6'Height'#2'|'#3'Top'#2'x'#5'Width'#3#128#1#0#0#9'TComboBox'
|
||||
+#11'cmbNewValue'#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#9'MaxLengt'
|
||||
+'h'#2#0#8'TabOrder'#2#3#4'Left'#2#8#6'Height'#2#25#3'Top'#3#8#1#5'Width'#3
|
||||
+#128#1#0#0#10'TImageList'#10'ImageList1'#4'left'#2#16#3'top'#3'`'#1#0#0#0
|
||||
]);
|
||||
|
@ -37,10 +37,13 @@ unit EvaluateDlg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
||||
StdCtrls, DebuggerDlg, BaseDebugManager;
|
||||
Classes, SysUtils, LResources, LCLType, Forms, Controls, Graphics, Dialogs,
|
||||
ComCtrls, StdCtrls, DebuggerDlg, BaseDebugManager;
|
||||
|
||||
type
|
||||
|
||||
{ TEvaluateDlg }
|
||||
|
||||
TEvaluateDlg = class(TDebuggerDlg)
|
||||
cmbExpression: TComboBox;
|
||||
cmbNewValue: TComboBox;
|
||||
@ -54,7 +57,10 @@ type
|
||||
tbWatch: TToolButton;
|
||||
tbModify: TToolButton;
|
||||
tbEvaluate: TToolButton;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure cmbExpressionChange(Sender: TObject);
|
||||
procedure cmbExpressionKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure tbEvaluateClick(Sender: TObject);
|
||||
procedure tbWatchClick(Sender: TObject);
|
||||
private
|
||||
@ -76,6 +82,21 @@ begin
|
||||
// tbInspect.Enabled := HasExpression;
|
||||
end;
|
||||
|
||||
procedure TEvaluateDlg.cmbExpressionKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
if (Key = VK_RETURN) and tbEvaluate.Enabled
|
||||
then begin
|
||||
tbEvaluate.Click;
|
||||
Key := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TEvaluateDlg.FormShow(Sender: TObject);
|
||||
begin
|
||||
cmbExpression.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TEvaluateDlg.tbEvaluateClick(Sender: TObject);
|
||||
var
|
||||
S, R: String;
|
||||
|
@ -1251,6 +1251,7 @@ type
|
||||
procedure UpdateVisibleToolbar;
|
||||
function GroupAllUpAllowed: boolean;
|
||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||
function DialogChar(var Message: TLMKey): boolean; override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
function CheckMenuDropdown: Boolean; dynamic;
|
||||
|
@ -163,6 +163,7 @@ var
|
||||
IconPos: TPoint;
|
||||
ImgList: TCustomImageList;
|
||||
ImgIndex: integer;
|
||||
TS: TTextStyle;
|
||||
begin
|
||||
//DebugLn('TToolButton.Paint A ',Name,' FToolBar=',DbgS(FToolBar),' ',ClientWidth,',',ClientHeight,' ',ord(Style));
|
||||
if (FToolBar<>nil) and (ClientWidth>0) and (ClientHeight>0) then begin
|
||||
@ -245,7 +246,14 @@ begin
|
||||
|
||||
// draw text
|
||||
if (TextSize.cx>0) then begin
|
||||
Canvas.TextOut(TextPos.X,TextPos.Y,Caption);
|
||||
TS := Canvas.TextStyle;
|
||||
TS.Alignment:= taCenter;
|
||||
TS.Layout:= tlCenter;
|
||||
TS.Opaque:= false;
|
||||
TS.Clipping:= false;
|
||||
TS.SystemFont:=Canvas.Font.IsDefault;
|
||||
TS.ShowPrefix:= true;
|
||||
Canvas.TextRect(PaintRect, TextPos.X, TextPos.Y, Caption, TS);
|
||||
end;
|
||||
|
||||
// draw separator (at runtime: just space, at designtime: a rectangle)
|
||||
@ -732,6 +740,16 @@ begin
|
||||
inherited DoSetBounds(ALeft, ATop, AWidth, AHeight);
|
||||
end;
|
||||
|
||||
function TToolButton.DialogChar(var Message: TLMKey): boolean;
|
||||
begin
|
||||
if IsAccel(Message.CharCode, Caption) and CanFocus then
|
||||
begin
|
||||
Click;
|
||||
Result := true;
|
||||
end else
|
||||
Result := inherited;
|
||||
end;
|
||||
|
||||
|
||||
// included by comctrls.pp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user