?
Solved

Undeclared Identifier

Posted on 2008-11-03
6
Medium Priority
?
3,149 Views
Last Modified: 2012-05-05
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

0
Comment
Question by:Michael Sterling
  • 3
  • 3
6 Comments
 
LVL 13

Expert Comment

by:ThievingSix
ID: 22870393
Add "Dialogs" to your uses clause.


0
 
LVL 1

Author Comment

by:Michael Sterling
ID: 22870422
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
 
LVL 13

Expert Comment

by:ThievingSix
ID: 22870464
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Michael Sterling
ID: 22870528
ok,...i was wondering if i'd have to do that, but didn't understand why,..until now. thanks.
0
 
LVL 13

Accepted Solution

by:
ThievingSix earned 2000 total points
ID: 22870815
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
 
LVL 1

Author Closing Comment

by:Michael Sterling
ID: 31512849
i think i like the last suggestion better,..its less work... ;-)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question