| View previous topic :: View next topic |
| Author |
Message |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 13/04/05 16:47 Post subject: Displaying multiple inputs simultaneously |
|
|
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 |
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 80 Location: Netherlands
|
Posted: 14/04/05 08:35 Post subject: |
|
|
Try the attached example...
| Description: |
|
 Download |
| Filename: |
example.rar |
| Filesize: |
3.12 KB |
| Downloaded: |
9 Time(s) |
|
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 14/04/05 11:33 Post subject: Displaying multiple inputs simultaneously |
|
|
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 |
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 14/04/05 11:39 Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 80 Location: Netherlands
|
Posted: 14/04/05 12:59 Post subject: |
|
|
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
|
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 14/04/05 19:25 Post subject: |
|
|
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 |
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 14/04/05 23:17 Post subject: more trouble |
|
|
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?
| Description: |
|
 Download |
| Filename: |
Project1.zip |
| Filesize: |
6.53 KB |
| Downloaded: |
3 Time(s) |
_________________ Thanks and Regards, David |
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 80 Location: Netherlands
|
Posted: 15/04/05 02:20 Post subject: |
|
|
David,
I'm quite high on 1 through 9 right now, so I'll come back to you an all this tomorrow...
Stefan :s
|
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 80 Location: Netherlands
|
Posted: 15/04/05 11:45 Post subject: |
|
|
And we're back...
Try this one, David.
| Description: |
|
 Download |
| Filename: |
Project1.rar |
| Filesize: |
6.17 KB |
| Downloaded: |
3 Time(s) |
|
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 15/04/05 15:32 Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 80 Location: Netherlands
|
Posted: 18/04/05 07:36 Post subject: |
|
|
Hi!
| Quote: | | is there a way to make the input stop accepting data after eight characters have been reached |
yes:
| Code: |
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
|
|
| Back to top |
|
 |
david griffith Member
Joined: 13 Apr 2005 Posts: 7 Location: London, England
|
Posted: 18/04/05 20:43 Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|