Sorry My mistake,
Yes you are right, I remembered a solution to a different problem and posted
it without much thinking.
This is an ugly hack but what the hell.
Copy the VCL unit that defins the combo box to your project directory.
Add a onAfterChange Event of the Combo box class, put the fOnAfterChang
at the end of the same procedure that calls fOnChange.

Thre were many problems like this that could have been avoided if VCL
designers would have
put in dual OnBeforeSomething and OnAfterSomething Event handlers.
Very often one needs to cancell the operation,  and OnBeforeEvent would have
been usefull for that
And sometimes (like now), one needs to do somethingafter the operation is
completed,
and a OnAfterEvent would be usefull.

you would need to shut down dophi, and restart, that way it would use your
customised copy
of that VCL unit.

I had tried deriving a combobox and over writing its methods in the past,
but there are too much
private methods in that unit that wont have access to.

 HTH
Arjang
On 1/26/07, Ross Levis <[EMAIL PROTECTED]> wrote:
>
> I don't see how that will help.  Changing the text property
> programatically doesn't fire the OnChange event.  It requires a manual
> selection in the combobox.
>
> Thanks anyway,
> Ross.
>
> ----- Original Message -----
> From: "Arjang Assadi" <[EMAIL PROTECTED]>
> To: "Borland's Delphi Discussion List" <[email protected]>
> Sent: Thursday, January 25, 2007 4:11 PM
> Subject: Re: Delay setting Text Property
>
>
> 1)detach the on changeEven
> 2)Change Text
> 3)re attach the on change event
>
> On 1/25/07, Ross Levis <[EMAIL PROTECTED]> wrote:
> >
> > I want to change the Text property of a ComboBox inside the OnChange
> > event.  Setting it directly doesn't work presumeably because the
> > OnChange event occurs before the change occurs rather than after.
> >
> > So I decided the best way to do this would be to send the WM_SETTEXT
> > message using PostMessage with a global variable storing the text...
> >
> > PostMessage(ComboBox1.Handle,WM_SETTEXT,0,Integer(pChar(GlobalString)));
> >
> > But this doesn't work either.  I read somewhere that Windows doesn't
> > allow PostMessage to work with string pointers because it's likely the
> > string address on the stack is temporary and will not exist after
> > PostMessage has been sent.  This may be correct in most cases but with
> > a
> > global string, the address of the string will be constant, so it would
> > work.
> >
> > SendMessage works with string pointers, but SendMessage waits until
> > the
> > message has been delivered before the procedure continues execution,
> > so
> > that defeats my purpose.
> >
> > Is there anyway to fool Windows into sending a WM_SETTEXT message
> > without waiting.  Or do I have to muck about with a timer or send my
> > own
> > user message to get this to work?
> >
> > Thanks,
> > Ross.
> >
> > _______________________________________________
> > Delphi mailing list -> [email protected]
> > http://www.elists.org/mailman/listinfo/delphi
> >
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to