Search code examples
delphilabelfiremonkeydelphi-xe8

How to change dragmode property of a label (firemonkey)


This must be so simple for you guys, but I don't have a clue what the problem is. This is the code:

unit Unit7;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, 
  System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, 
  FMX.StdCtrls,
  FMX.Controls.Presentation;

type
  TForm7 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form7: TForm7;

implementation

{$R *.fmx}

procedure TForm7.Button1Click(Sender: TObject);
begin
label1.dragmode:=dmautomatic;
end;

end.

All I've done is created a form, put a label and a button on it, and attempt to change the DragMode property of the label to dmAutomatic when the button is clicked.

The program won't compile, the compiler simply states:

undeclared identifier: dmautomatic.

I've missed something incredibly obvious, but I can't see what it is.


Solution

  • FireMonkey is compiled with Scoped Enums enabled. So, you have to prefix dmAutomatic with its enum type name, TDragMode, eg:

    Label1.DragMode := TDragMode.dmAutomatic;