?
Solved

Edit in a MessageDlg

Posted on 2003-12-09
5
Medium Priority
?
309 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 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

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!

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…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

864 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