Undeclared Identifier

i've got an elementary question, so elementary that i'm almost afraid to ask,..but i gotta do what i gotta do...i'm trying to customize the CreateMessageDialog function from the Dialogs unit. I've copied and pasted the function into my code and renamed it CreateMyMessageDialog. I have included the Dialogs unit in my uses clause. When i try to compile my code i get this error:

[Error] SwipeForm.pas(xxx): Undeclared identifier: 'TMessageForm'

on this line:

Result := TMessageForm.CreateNew(Application);

which is pretty much the first line of code in the function (snippet included), so what am i doing wrong


function TfrmSwipeEntry.CreateMyMessageDialog(const Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons): TForm;
const
  mcHorzMargin = 8;
  mcVertMargin = 8;
  mcHorzSpacing = 10;
  mcVertSpacing = 10;
  mcButtonWidth = 50;
  mcButtonHeight = 14;
  mcButtonSpacing = 4;
var
  DialogUnits: TPoint;
  HorzMargin, VertMargin, HorzSpacing, VertSpacing, ButtonWidth,
  ButtonHeight, ButtonSpacing, ButtonCount, ButtonGroupWidth,
  IconTextWidth, IconTextHeight, X, ALeft: Integer;
  B, DefaultButton, CancelButton: TMsgDlgBtn;
  IconID: PChar;
  TextRect: TRect;
begin
  Result := TMessageForm.CreateNew(Application); <--error happens here
  .
  .
  .
end;

Open in new window

LVL 1
Michael SterlingWeb Applications DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dagan HooverDeveloperCommented:
Add "Dialogs" to your uses clause.


0
Michael SterlingWeb Applications DeveloperAuthor Commented:
its in there,..i mentioned that in the description...also my ultimate goal here is to change the size of the MessageDlg window. I've got the font changed but now the window itself is too small for the font and i need to change the size of it...
0
Dagan HooverDeveloperCommented:
Ah, I completely missed it. Your going to have to import the TMessageForm type and all it's methods to your unit as well because TMessageForm isn't publicly declared in dialogs.
0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Michael SterlingWeb Applications DeveloperAuthor Commented:
ok,...i was wondering if i'd have to do that, but didn't understand why,..until now. thanks.
0
Dagan HooverDeveloperCommented:
The other thing you can do is make the TMessageDialog type declaration public. You can do this by moving this:

type
  TMessageForm = class(TForm)
  private
    Message: TLabel;
    procedure HelpButtonClick(Sender: TObject);
  protected
    procedure CustomKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure WriteToClipBoard(Text: String);
    function GetFormText: String;
  public
    constructor CreateNew(AOwner: TComponent); reintroduce;
  end;


to somewhere above this:

implementation
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael SterlingWeb Applications DeveloperAuthor Commented:
i think i like the last suggestion better,..its less work... ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.