Solved

Edit in a MessageDlg

Posted on 2003-12-09
5
301 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
  • 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 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now