| View previous topic :: View next topic |
| Author |
Message |
Oren (Halvani.de) Guest
|
Posted: Tue Jul 29, 2003 9:28 pm Post subject: display ascii codes as TButton via Cast<>...How ?? |
|
|
hi dear builders,
I need a little function that displays all ascii-codes as TButton (caption)
in a 2nd form,
OnEvent Click they should insert the ascii code in the 1st form's TEdit
box...
How can I do that ? Isn't there a possibility to create TButton dynamicly
via Cast < > (I forgot the syntax...) where each TButton representing a
ascii-code ??
something like this should work for diplaying the ascii codes:
char x;
for (int i = 0; i < 255; i++)
{
// char = i // ??? wrong...
}
Have someone a idea for me..?
Oren
|
|
| Back to top |
|
 |
Thorsten Kettner Guest
|
Posted: Wed Jul 30, 2003 6:06 am Post subject: Re: display ascii codes as TButton via Cast<>...How ?? |
|
|
"Oren (Halvani.de)" <neroniker (AT) gmx (DOT) de> wrote:
| Quote: | I need a little function that displays all ascii-codes as TButton (caption)
in a 2nd form, OnEvent Click they should insert the ascii code
in the 1st form's TEdit >box...
How can I do that ? Isn't there a possibility to create
TButton dynamicly [snip]
|
Dynamically? Why??? If you want a form with 256 buttons then
build it thus. There is nothing dynamically about it!
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Wed Jul 30, 2003 1:11 pm Post subject: Re: display ascii codes as TButton via Cast<>...How ?? |
|
|
JD wrote:
| Quote: | void __fastcall TForm1::GenericButtonClick(TObject* Sender)
{
TButton* B = dynamic_cast<TButton *>( Sender );
Edit1->SelText = IntToStr( B->Tag );
|
Think that should be:
Edit1->SelText = (char)B->Tag;
or
Form2->Edit1->SelText = (char)B->Tag;
moreover you forgot to assign the eventhandler, add:
aBtn[ Index ] = GenericButtonClick;
Well Oren, could you please tell us how this all works ?
Hans.
|
|
| Back to top |
|
 |
|