[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


Make the user required to enter text in a InputQuery,part2

Posted on 2009-07-16
Medium Priority
Last Modified: 2012-05-07
I have asked this question twice but did not get a good solution.
And I think its because I didn´t tell it right. So this time i do it with
pictures. And I hope someone can help me. And it is possible because
the pictures I have posted comes from another application.

Step1: The user presses the Folder-button on the toolbar to create a Folder-node in the treeview.
Step2: The input-appears. The user must give the node a name, so he-she must put at least 1 character in it.
Step3: Because when he doesn´t a message appears.
Step4: After pressing the OK-button of the message. The input-query is still waiting for input.
           (unless you press the Cancel-button afcourse)
           In other words: its not possible to give the treenode no name.

I have put in the CODE-SECTION the File and Folder procedures.
The only thing that´s wrong with these procedures is in step 4.
When the user press the OK-button of the message the input-query
dissapear too.

I really hope someone can help me this time.

Thank you in advanced.

Peter Kiers

procedure TForm1.FileBtnClick(Sender: TObject);
var aText: string;
  aText := '';
  if (TreeView1.Selected <> nil) and (TreeView1.Selected.ImageIndex = 15) then
     if InputQuery('New Item', 'New Item Name:', aText) then
        if length(trim(aText)) > 0 then  AddItem(aText, 17, TreeView1.Selected)
        else MessageBox(0, 'You must enter an item name.', 'Error', MB_OK + MB_ICONEXCLAMATION);
  end else
    ShowMessage('Select a folder in the treeview first.');
procedure TForm1.FolderBtnClick(Sender: TObject);
var aText: string;
  aParent: TTreeNode;
  aParent := nil;
  if TreeView1.Selected <> nil then
    if TreeView1.Selected.ImageIndex = 15 then
      aParent := TreeView1.Selected
      ShowMessage('Select a folder first');
  if InputQuery('New Folder', 'New Folder Name:', aText) then
      if length(trim(aText)) > 0 then  AddItem(aText, 15, aParent)
      else MessageBox(0, 'You must enter a folder name.', 'Error', MB_OK + MB_ICONEXCLAMATION);

Open in new window

Question by:peterkiers
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
LVL 14

Accepted Solution

SteveBay earned 2000 total points
ID: 24871870
The problem is that ImputQuery doe not have any validation built into it. In order to have a Modal prompt dialog stay up while you are displaying the validation message you will need to create your own Imput dialog and put the validation there. In the case of InputQuery you can only perform validation aftrer it has return from it's modal state and given you a result.

Author Comment

ID: 24871990
Ok I understand now. Thanks for the info.

peter Kiers

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

650 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