Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Edit in a MessageDlg

Posted on 2003-12-09
Medium Priority
Last Modified: 2010-07-27
I want to create message dialog with edit  inside and use it !Is this possible?
Question by:vmilanov
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 27

Expert Comment

ID: 9904643
just use a form
-set the borderstyle to bsDialog
-place your controls and buttons
-assign a modalResult to the buttons

and use it in your code like

with TMyNewDialog.Create(self) do
  result := showmodal;
  if result = mrOK then
  //.. read out your edits here
     something := DialogEdit1.text;
  //free it

just as suggestion

meikl ;-)

Expert Comment

ID: 9905064
Even easier. Use InputQuery (ij the Dialogs unit). There are a few versions for strings, integers, reals etc.

Geoff M.

Expert Comment

ID: 9906387
Correction: (IN the Dialogs unit).
LVL 27

Expert Comment

ID: 9906408
ouch, this nice  looking inputquery-box (sarkasm),
but well, maybe its enough

meikl ;-)

Accepted Solution

songhd earned 375 total points
ID: 9909420
I give u a example to solve.

This example uses a button and a label on the form. When the user clicks the button, the input box displays. If the user chooses OK, the string that appears in the edit box of the dialog box displays as the caption of the label on the form. If the user chooses Cancel, the dialog box closes and the caption of the label remains unchanged:

procedure TForm1.Button1Click(Sender: TObject);
  NewString: string;
  ClickedOK: Boolean;
  NewString := 'Default String';
  Label1.Caption := NewString;
  ClickedOK := InputQuery('Input Box', 'Prompt', NewString);
  if ClickedOK then            { NewString contains new input string }
    Label1.Caption := 'The new string is ''' + NewString + '''';

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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