Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need assistance creating a Control control
Message
De
18/08/2005 17:04:16
Mike Sue-Ping
Cambridge, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01040983
Message ID:
01042075
Vues:
36
I was also setting it in "design time" too, i.e. via the form designer :)

The reason that I chose a Control control was so that I could hide all the "guts" and try to keep it as "automatic and simple" as possible for other to use by setting properties. With the container control, others will have to know what objects within it need to be setup before using it. Not too difficult to explain and do, but, just not as simple as I wish it could be.

I have now got the same functionality duplicated in a container control that is setup using a builder. It works.

Thanks for assisting,

Mike



>Oh, ok I see. I was setting it in design time.
>
>Is there some reason you cannot use a container instead? Then
>the builder approach would work fine.
>
>
>
>>Hi Kevin,
>>
>>I just tested your code and, yes it does indeed work, but, only up to a point :) Where it fails and produces an error is when you take your control and drop it onto a form. Now when you run your builder, it fails upon exiting with the error that I described below.
>>
>>Mike.
>>
>>
>>>I just retested my code. Works fine.
>>>
>>>I emailed you the project.
>>>
>>>Kevin
>>>
>>>
>>>
>>>
>>>
>>>>Hi Kevin,
>>>>
>>>>This almost worked. The problem that I'm having is that oObject.label1 is an "Unknown member". If I go to the debugger and investigate oObject, I can see that it has a "label1" object but its value is "(Expression could no be evaluated)".
>>>>
>>>>Is this something to do with the fact that I'm using a Control control and not a Container control? Any ideas?
>>>>
>>>>Thanks,
>>>>
>>>>Mike
>>>>
>>>>
>>>>>Create a program called MyBuilder.prg and add the following code:
>>>>>
>>>>>
>>>>>LPARAMETERS oObject, cButton
>>>>>
>>>>>cCaption = INPUTBOX("Enter a caption")
>>>>>
>>>>>oObject.label1.Caption = cCaption
>>>>>
>>>>>RETURN
>>>>>
>>>>>
>>>>>
>>>>>Add a property to your class called 'builder'
>>>>>
>>>>>Set it to the full path and name of the builder prg you created.
>>>>>
>>>>>Right click on the class and choose 'builder' from the menu.
>>>>>
>>>>>The code above will run.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I'm trying to create a custom control based on the VFP control class. At design time I dropped a label in the control along with a shape. I created a custom property for the control named Caption that has an assign method to change the label's caption. In the control's init event, I set Caption=Caption to force the assign to update the label's caption.
>>>>>>
>>>>>>This works fine at runtime. How can I update the label's caption at design time? When I drop a instance of this class on a form, the label and shape objects are not available (since it is a Control control).
>>>>>>
>>>>>>Regards,
>>>>>>
>>>>>>Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform