Skip to content

Commit

Permalink
fix for frmmemreccomboboxunit
Browse files Browse the repository at this point in the history
  • Loading branch information
cheat-engine committed Aug 16, 2016
1 parent 2e21634 commit f51cf9e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
16 changes: 9 additions & 7 deletions Cheat Engine/frmmemreccomboboxunit.lfm
@@ -1,22 +1,24 @@
object frmMemrecCombobox: TfrmMemrecCombobox
Left = 449
Left = 402
Height = 81
Top = 268
Width = 243
Top = 137
Width = 250
AutoSize = True
BorderStyle = bsDialog
Caption = 'Change value'
ClientHeight = 81
ClientWidth = 243
ClientWidth = 250
Constraints.MinWidth = 250
OnDestroy = FormDestroy
OnShow = FormShow
PopupMode = pmAuto
Position = poScreenCenter
LCLVersion = '1.6.0.4'
object cbMemrecCombobox: TComboBox
Left = 2
Height = 23
Top = 15
Width = 239
Width = 246
Align = alTop
BorderSpacing.Left = 2
BorderSpacing.Right = 2
Expand All @@ -27,7 +29,7 @@ object frmMemrecCombobox: TfrmMemrecCombobox
Left = 0
Height = 15
Top = 0
Width = 243
Width = 250
Align = alTop
Caption = 'Change value to:'
ParentColor = False
Expand All @@ -37,7 +39,7 @@ object frmMemrecCombobox: TfrmMemrecCombobox
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = cbMemrecCombobox
AnchorSideTop.Side = asrBottom
Left = 43
Left = 47
Height = 25
Top = 42
Width = 157
Expand Down
17 changes: 12 additions & 5 deletions Cheat Engine/frmmemreccomboboxunit.pas
Expand Up @@ -20,6 +20,7 @@ TfrmMemrecCombobox = class(TForm)
Panel1: TPanel;
procedure btnOkClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ private declarations }
valuelist: tstringlist;
Expand All @@ -44,6 +45,17 @@ procedure TfrmMemrecCombobox.FormDestroy(Sender: TObject);
freeandnil(valuelist);
end;

procedure TfrmMemrecCombobox.FormShow(Sender: TObject);
var i,maxwidth: integer;
begin
maxwidth:=clientwidth;
for i:=0 to cbMemrecCombobox.Items.Count-1 do
maxwidth:=max(maxwidth, cbMemrecCombobox.Canvas.TextWidth(cbMemrecCombobox.items[i]));

if maxwidth<>clientwidth then
Constraints.MinWidth:=maxwidth+16;
end;

procedure TfrmMemrecCombobox.btnOkClick(Sender: TObject);
begin
if (cbMemrecCombobox.itemindex=-1) and memrec.DropDownReadOnly then
Expand Down Expand Up @@ -88,12 +100,7 @@ constructor TfrmMemrecCombobox.create(memrec: TMemoryrecord);
self.memrec:=memrec;

cbMemrecCombobox.DropDownCount:=min(16, cbMemrecCombobox.items.count);
maxwidth:=width;
for i:=0 to cbMemrecCombobox.Items.Count-1 do
maxwidth:=max(maxwidth, cbMemrecCombobox.Canvas.TextWidth(cbMemrecCombobox.items[i]));

if maxwidth<>width then
width:=maxwidth+16;

end;

Expand Down

0 comments on commit f51cf9e

Please sign in to comment.