Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inherited Form
Message
De
04/12/2007 00:58:44
 
 
À
03/12/2007 16:20:34
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Divers
Thread ID:
01251758
Message ID:
01273002
Vues:
16
I see what you meant now, thanks.

Sorry, for such a long article to be given as a link, but since it had triggered this discussion, just the excerpt from that:

"In many ways, user controls work just like forms. You can subclass them the same way, control visibility works the same way, etc. You can easily drop a user control on a form. Unfortunately, the designer doesn't handle user controls as well as in Visual FoxPro. The major limitation is that it isn't possible to manipulate controls within the instantiated user control through the designer, even if the controls are set to public. This is simply a designer shortcoming, not an issue with the underlying object model. In fact, all the controls are available and you can manipulate them through source code. Hopefully, a future version of VS.NET will provide better designer support in this area."


In my defence I may find a limitation even now , though you can see WebBrowser properties at the second level, you can't bind events via property/event sheet to that property FullViewBrowser, unless I am missing something again. Perhaps, it is matter of using different approaches to usercontrol design , plus nothing wrong with writing some event/delegate binding code by hand. For now it is a dumb container mainly to lay things out.


>OK, Michael ... a couple of things.
>
>First, I didn't see anything that really relates to this in the link you have to vfpconversion.
>
>But secondly, now I think I understand the confusion, because you just mentioned the "drop down menu" of the Property Sheet. No, your properties in your UserControl won't show up there. But, they will show up in the list of Properties for your UserControl.
>
>So, you drop your HtmlHitlist user control on a Form (and call it MyHtmlHitList). You then go to the Property Sheet for your Form, go to the drop down list, find and choose MyHtmlHitList. Now, in the list of properties associated with MyHtmlHitList, you *should* see a property for FullViewBrowser.
>
>Does that make sense now?
>
>~~Bonnie
>
>
>
>
>>TWWebBrowser is my subclassed WebBrowser in a spirit of Foxpro guidelines.
>>I've just tried to add a label, and a property for label to my usercontrol
>>
>> public Label LLabel
>> {
>> get { return label1; }
>> set { label1 = value; }
>> }
>>
>>but it didn't make any difference , I can't see LLabel in drop down menu of properties on a form where I put a parent usercontrol with that label.
>>
>>Folks at
>>
>>http://www.vfpconversion.com/Article.aspx?quickid=050084
>>
>>seem to confirm my statement for public children ( they don't mention children wrapped as properties though ). Article related to VS2003 , I am in VS 2008 from Friday , but the same behaviour.
>>It would be interesting to see the simple example how it works at solution level if you could expose it somehow , as usercontrol is very important building block , and it would be very handy to see elements of that in properties.
>>
>>>Strange. The Property *should* show up in your Property Sheet. I have plenty of controls sub-classed from UserControl, so I know it works. The only thing I can think of is that it might have something to do with the type of property being something called TWWebBrowser (I don't know what that is). Maybe a reference needs to be added? I don't know ... just guessing.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>Perhaps, I misunderstood your point. Assuming I've got user control with a split container and 2 browser controls in the panels.
>>>>I created a property , though member fullViewBrowser is internal anyway.
>>>>
>>>>   public partial class HtmlHitlist : UserControl
>>>>    {
>>>>
>>>>        public TWWebBrowser FullViewBrowser
>>>>        {
>>>>            get { return fullViewBrowser; }
>>>>            set { fullViewBrowser = value; }
>>>>        }
>>>>
>>>>I put control on a form tab page as htmlHitList1
>>>>Am I supposed to see FullViewBrowser in Properties for that form ? Probably not, as I don't. For some reason in VS they decided to treat usercontrol as a black box in designer view. Surely either member or property are accessible in a code.
>>>>
>>>>
>>>>        protected override void OnShown(EventArgs e)
>>>>        {
>>>>
>>>>                base.OnShown(e);
>>>>                this.htmlHitlist1.FullViewBrowser.DocumentText = "<html><hr><h2>Full view</h2><hr></html>";
>>>>                this.htmlHitlist1.fullViewBrowser.DocumentText = "<html><hr><h2>Full view</h2><hr></html>";
>>>>
>>>>   ...
>>>>
>>>>
>>>>
>>>>>>Just curious , does similar limitation apply to usercontrol used as a container. Unlike Visual Foxpro when placed on a form, children are not editable via property sheet regardless of access modifier. No problem to deal with them programmatically.
>>>>>
>>>>>No, there is no such limitation with UserControls ... but to be able to edit them via the Property Sheet, you would need real properties (with get/set), rather than simply protected or public modifiers.
>>>>>
>>>>>~~Bonnie
>>>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform