Displaying multiple inputs simultaneously

Please discuss general Delphi programming topics here.

Displaying multiple inputs simultaneously

Postby david griffith » April 13th, 2005, 4:47 pm

Hi There, I am relatively new to programming and I have a problem that I am struggling with.

I wish to press an on-screen key and then put the input value for the key on the screen in one display box, and simultaneously use this same input to pull out the value from an array and place these contents in another box. This action is repeated a further 9 times with each of the values remaining on the screen adjacent to each other in a single string, each using a separate array sequentially.

[i.e. the keys 3,8,5,2 being pressed, should show 3852 in one screen; and apple, orange, pear, grape appearing in other boxes, with these values having been extracted from those indexes from each respective array]

It would also be useful to be able to rollback a single key input if an error is made with a clear key, and a second press of this key should then clear the screen of all the remaining digits present. Any assistance at all would be appreciated!
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Postby Stefan » April 14th, 2005, 8:35 am

Try the attached example...
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Displaying multiple inputs simultaneously

Postby david griffith » April 14th, 2005, 11:33 am

Hi Stephan, thank you for your reply but the file will not open in notepad for some reason. Please could you check this out for me. Kind regards...
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Postby david griffith » April 14th, 2005, 11:39 am

Stefan, I forget to mention that I did open the archive file first to reveal the project1.cfg file, but this appears to contain no data.....
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Postby Stefan » April 14th, 2005, 12:59 pm

David,

You need to extract all the files that are in the compressed file to one folder. These files should be:
- Project1.cfg
- Project1.dof
- Project1.dpr
- Project1.res
- Unit1.dfm
- Unit1.pas

After this, you open the file project1.dpr from Delphi (5) -> Open project...
Press F9 to compile and run...

Cheers,
Stefan
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby david griffith » April 14th, 2005, 7:25 pm

Hi Stefan, the example project file that you sent is very good and I am extremely pleased. I truely thank you for your assistance.
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

more trouble

Postby david griffith » April 14th, 2005, 11:17 pm

Stefan, thanks to your help I have made some good progress but I need to make some more amendments. I have changed the listbox to a series of edit boxes and also created more arrays, but the text in each edit box should only be present after each successive input and not all at the same time.

I was thinking that If I could count the amount of positions present in Edit1.Text and then copy this to another variable, I could then this could perhaps use this to test the if the value is first out of range as the arrays have different sizes, then put the same value from the corresponding array into the edit box.

i.e. 3,2 should show 'pot' in the first window with the first key, and 'prog2' in the second window but only after the second key is pressed. Do you have any ideas that I could try?
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Postby Stefan » April 15th, 2005, 2:20 am

David,

I'm quite high on 1 through 9 right now, so I'll come back to you an all this tomorrow...

Stefan :s
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby Stefan » April 15th, 2005, 11:45 am

And we're back...

Try this one, David.
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby david griffith » April 15th, 2005, 3:32 pm

Stefan, this is coming on well and I would not have got anywhere near to this result myself without your assistance. I also need to create a total of eight edit boxes, which I can do by adding the components and extending the arrays. But is there a way to make the input stop accepting data after eight characters have been reached, and make the backspace key function remove the contents of the last edit box at the same time as the number in the first edit box? Everthing else I will do as I complete the rest of program.
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Postby Stefan » April 18th, 2005, 7:36 am

Hi!

is there a way to make the input stop accepting data after eight characters have been reached


yes:

Code: Select all
procedure TForm1.AddNumberToEdit(Sender: TObject);
begin
  if Length(Edit1.Text) < 8 then begin
    Edit1.Text := Edit1.Text + IntToStr((Sender as TComponent).Tag);
    ListBox1.Items.Add(FirstArray[(Sender as TComponent).Tag]);
  end else
    ShowMessage('Maximum reached');
end;


Cheers,
Stefan
User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands

Postby david griffith » April 18th, 2005, 8:43 pm

Stefan, I am very grateful this worked a treat. I can now work on the rest of the program thanks to your help. I have also just purchased my 4th Delphi Book so I hope to get better soon!
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

david griffith

Postby putu-82 » August 24th, 2005, 5:20 am

please give me to the code. Thank's
putu-82
Active Member
Active Member
 
Posts: 6
Joined: August 24th, 2005, 4:01 am

please

Postby suryo » August 25th, 2005, 2:43 am

could u give me the files also coz i'm a begginer in delphi programing
suryo
Member
Member
 
Posts: 1
Joined: August 22nd, 2005, 3:37 am

Postby david griffith » September 6th, 2005, 3:09 pm

I have been away for a short while. I need to locate an added component before I pass the files. I will do so just as soon as I can. David
Thanks and Regards, David
david griffith
Active Member
Active Member
 
Posts: 10
Joined: April 13th, 2005, 4:37 pm
Location: London, England

Next

Return to Delphi Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron