>I am attempting to implement a simple mechanism to translate application UI into other languages. The mechanism so far works fine on static captions (labels, checkboxes, radio buttons etc).
>
>However, I would like to use BINDEVENTS to capture when a caption is changed programmatically, and replace the assigned caption with a translated version. The problem is that the caption is momentarily assigned the new translation, but then reverts to the untranslated version. The flag parameter of BINDEVENTS seems to offer ways of controlling this behaviour for events (ie triggering the delegate after the event), but the flags do not seem to affect the setting of properties.
>
>Overall, a better approach would probably have been to have subclassed all labels and then use an assign method, but as this would require substantial reengineering, I would prefer something that could be carried dynamically.
>
>I use the following command to create the binding:
>
>
>BINDEVENT(m.tmpSrc, "Caption", oTranslateTools, "Translater")
>
>
>And the following class to intercept the caption change and replace with a translated version:
>
>
>
>DEFINE CLASS TranslateTools AS Custom
>
>PROCEDURE Translater
>
> * Get the object raising the event
> LOCAL ARRAY EventArray(1)
> AEVENTS(EventArray, 0)
> oCtrl = EventArray(1)
>
> oCtrl.Caption = Translate(oCtrl.Caption)
>
>ENDPROC
>
>
>
>However as soon as the translater procedure returns, the caption reverts.
>
>Any ideas?
Did you try setting flags parameter to 1?
I think what happens is as with a built-in event:
-Your code executes
-Default executes (like Dodefault not supressed with a nodefault)
Cetin