Page 1 of 2
Displaying multiple inputs simultaneously

Posted:
April 13th, 2005, 4:47 pm
by david griffith
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!

Posted:
April 14th, 2005, 8:35 am
by Stefan
Try the attached example...
Displaying multiple inputs simultaneously

Posted:
April 14th, 2005, 11:33 am
by david griffith
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...

Posted:
April 14th, 2005, 11:39 am
by david griffith
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.....

Posted:
April 14th, 2005, 12:59 pm
by Stefan
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

Posted:
April 14th, 2005, 7:25 pm
by david griffith
Hi Stefan, the example project file that you sent is very good and I am extremely pleased. I truely thank you for your assistance.
more trouble

Posted:
April 14th, 2005, 11:17 pm
by david griffith
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?

Posted:
April 15th, 2005, 2:20 am
by Stefan
David,
I'm quite high on 1 through 9 right now, so I'll come back to you an all this tomorrow...
Stefan :s

Posted:
April 15th, 2005, 11:45 am
by Stefan
And we're back...
Try this one, David.

Posted:
April 15th, 2005, 3:32 pm
by david griffith
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.

Posted:
April 18th, 2005, 7:36 am
by Stefan
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

Posted:
April 18th, 2005, 8:43 pm
by david griffith
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!
david griffith

Posted:
August 24th, 2005, 5:20 am
by putu-82
please give me to the code. Thank's
please

Posted:
August 25th, 2005, 2:43 am
by suryo
could u give me the files also coz i'm a begginer in delphi programing

Posted:
September 6th, 2005, 3:09 pm
by david griffith
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