Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing a property at runtime
Message
De
13/11/2004 10:38:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
13/11/2004 10:30:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Database:
Visual FoxPro
Divers
Thread ID:
00961048
Message ID:
00961156
Vues:
22
>>The name is one of the few properties you can't change. Why would you need to change that one?
>
>Thanks for answering, my stimated Hilmar.
>
>The reason is that I want to change my buttons for an image control class dinamically. In order to do that, I made button invisible, and copy button visible properties (width, height, top, left) to image control. You can see two problems in this approach: 1)When user clicks on the image control it must performs command click method, and 2)When another control reffers to command properties such as Enabled, Visible or so, changes must be applied to image, instead.
>
>I solved the first problem in that way. a)setting Command.Visible = .F. b)storing name of button in an Image control property, c)calling Command.Click from Image.Clik throuhg stored name of commanbutton.
>
>The second problem is the big one. If another control has a "Command1.Enabled = .F." changes must be applied to image, not command. The solution that came to my mind was to assign Command.Name to Image control and change Command.Name. It works partially. I mean, if command is simply on a form or into a container on a form, it really works. But, if command in on a container IN A CLASS, and that class in on a form, doesn't work. So, second problem is still arise.
>
>Can you see now?

Methinks you can still save the name of the image control in a property. For example, in some property (for an example, I will use a form property, .oImageControl), save the value: "ThisForm.CntMyClass.Image1", if that is where the image will be accessed.

Now, to access this object:
local loImage
loImage = eval(ThisForm.oImageControl)
loImage.Picture = ...
loImage.Visible = .T.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform