BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

display ascii codes as TButton via Cast<>...How ??

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Oren (Halvani.de)
Guest





PostPosted: Tue Jul 29, 2003 9:28 pm    Post subject: display ascii codes as TButton via Cast<>...How ?? Reply with quote



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





PostPosted: Wed Jul 30, 2003 6:06 am    Post subject: Re: display ascii codes as TButton via Cast<>...How ?? Reply with quote




"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





PostPosted: Wed Jul 30, 2003 1:11 pm    Post subject: Re: display ascii codes as TButton via Cast<>...How ?? Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.