?
Solved

Edit in a MessageDlg

Posted on 2003-12-09
5
Medium Priority
?
307 Views
Last Modified: 2010-07-27
I want to create message dialog with edit  inside and use it !Is this possible?
0
Comment
Question by:vmilanov
[X]
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
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
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
begin
  result := showmodal;
  if result = mrOK then
  //.. read out your edits here
     something := DialogEdit1.text;
  //free it
  release;
end;

just as suggestion

meikl ;-)
0
 
LVL 8

Expert Comment

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

Geoff M.
0
 
LVL 8

Expert Comment

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

Expert Comment

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

meikl ;-)
0
 

Accepted Solution

by:
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);
var
  NewString: string;
  ClickedOK: Boolean;
begin
  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 + '''';
end;
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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
Course of the Month13 days, 17 hours left to enroll

801 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