Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use BINDEVENT to intercept dynamic caption changes
Message
De
04/08/2006 08:51:30
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
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:
01142945
Vues:
8
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform