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 

TCustomEdit::OnChange not firing as expected

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





PostPosted: Thu May 25, 2006 8:14 pm    Post subject: TCustomEdit::OnChange not firing as expected Reply with quote



I have an UpDown control associated with an edit box, on a form that is not visible. I intialize them by setting
UpDown->Position to a value. I want the Edit box to get updated at this time, but the expected edit box Change event doesn't occur until I show the form. I don't understand why it works this way.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 25, 2006 8:14 pm    Post subject: Re: TCustomEdit::OnChange not firing as expected Reply with quote



"DaveD" <ddebenedetto (AT) telular (DOT) com> wrote in message
news:447609b9$1 (AT) newsgroups (DOT) borland.com...

Quote:
I have an UpDown control associated with an edit box, on a form that
is not visible. I intialize them by setting UpDown->Position to a value. I
want the Edit box to get updated at this time

It will be.

Quote:
the expected edit box Change event doesn't occur until I show the form.
I don't understand why it works this way.

That is how it is supposed to work. The OnChange event is triggered in
response to EN_CHANGE notifications, which are not sent for hidden controls.
Changing the TUpDown while the TEdit is hidden will not trigger the TEdit's
OnChange event. If you need the OnChange event to be triggered, you will
have to trigger it manually in your code, ie:

UpDown1->Position = whatever;
Edit1Change(Edit1);


Gambit
Back to top
DaveD
Guest





PostPosted: Fri May 26, 2006 12:42 am    Post subject: Re: TCustomEdit::OnChange not firing as expected Reply with quote



Quote:
If you need the OnChange event to be triggered, you will
have to trigger it manually

Thank you. I added the manual trigger as you suggested, but OnChange still fires again when the form is shown. Is there a way to prevent this?

BTW, this only happens the first time the form is shown; the form is created at program startup and is never destroyed.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 26, 2006 12:55 am    Post subject: Re: TCustomEdit::OnChange not firing as expected Reply with quote

"DaveD" <ddebenedetto (AT) telular (DOT) com> wrote in message
news:447616ac$1 (AT) newsgroups (DOT) borland.com...

Quote:
I added the manual trigger as you suggested, but OnChange still fires
again when the form is shown. Is there a way to prevent this?

Nope. You will just have to set a flag somewhere so you know that you
triggered it manually, and then ignore the event if the flag is set.


Gambit
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.