Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use BINDEVENT to intercept dynamic caption changes
Message
 
 
À
04/08/2006 08:25:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01142937
Message ID:
01142953
Vues:
13
>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?

May be you can use ProgrammaticChange?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform