Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Doing a simplistic 'extender provider'

Doing a simplistic 'extender provider'

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zombies with Coffee LLC
    wrote on last edited by
    #1

    I've really tried to make sense out of the extender provider samples, but not a one of them does the same way, and none of them are relatively trivial. What I am looking for is the ability to add one simple 'boolean' to every object on my form. Sounds simple... So what am I doing wrong? I added on a project to my main application and created a component of out this. I can get it to show up, but in no combination of aggravation can I make the boolean property appear on the controls. Can anyone help me out! Thanks!! ---------------------------------------------- using System; using System.ComponentModel; using System.Windows.Forms; namespace StatusMessage { [ProvideProperty( "StatusMessage", typeof( Object ))] public class StatusMessaging : Component, IExtenderProvider { private bool bUpdateStatusBar = false; [DefaultValue(false)] public bool GetStatusMessage( Control pControl ) { return bUpdateStatusBar; } public void SetStatusMessage( Control pControl, bool value ) { bUpdateStatusBar = value; } public bool CanExtend( object pControl ) { if( pControl is Component ) return true; else return false; } } }

    Z 1 Reply Last reply
    0
    • Z Zombies with Coffee LLC

      I've really tried to make sense out of the extender provider samples, but not a one of them does the same way, and none of them are relatively trivial. What I am looking for is the ability to add one simple 'boolean' to every object on my form. Sounds simple... So what am I doing wrong? I added on a project to my main application and created a component of out this. I can get it to show up, but in no combination of aggravation can I make the boolean property appear on the controls. Can anyone help me out! Thanks!! ---------------------------------------------- using System; using System.ComponentModel; using System.Windows.Forms; namespace StatusMessage { [ProvideProperty( "StatusMessage", typeof( Object ))] public class StatusMessaging : Component, IExtenderProvider { private bool bUpdateStatusBar = false; [DefaultValue(false)] public bool GetStatusMessage( Control pControl ) { return bUpdateStatusBar; } public void SetStatusMessage( Control pControl, bool value ) { bUpdateStatusBar = value; } public bool CanExtend( object pControl ) { if( pControl is Component ) return true; else return false; } } }

      Z Offline
      Z Offline
      Zombies with Coffee LLC
      wrote on last edited by
      #2

      Let me update the code. After 300 iterations, it just didn't look right namespace StatusMessage { /// /// Summary description for UserControl1. /// [ProvideProperty( "StatusMessage", typeof( bool ))] public class StatusMessaging : Component, IExtenderProvider { /// /// Required designer variable. /// protected bool bUpdateStatusBar = false; public bool GetStatusMessage( Control pControl ) { return bUpdateStatusBar; } public void SetStatusMessage( Control pControl, bool value ) { bUpdateStatusBar = value; } public bool CanExtend( object pControl ) { if( pControl is Control ) return true; return false; } } }

      D 1 Reply Last reply
      0
      • Z Zombies with Coffee LLC

        Let me update the code. After 300 iterations, it just didn't look right namespace StatusMessage { /// /// Summary description for UserControl1. /// [ProvideProperty( "StatusMessage", typeof( bool ))] public class StatusMessaging : Component, IExtenderProvider { /// /// Required designer variable. /// protected bool bUpdateStatusBar = false; public bool GetStatusMessage( Control pControl ) { return bUpdateStatusBar; } public void SetStatusMessage( Control pControl, bool value ) { bUpdateStatusBar = value; } public bool CanExtend( object pControl ) { if( pControl is Control ) return true; return false; } } }

        D Offline
        D Offline
        David Wengier
        wrote on last edited by
        #3

        psdavis wrote: [ProvideProperty( "StatusMessage", typeof( bool ))] Try making it typeof(Control). You need to tell the UI what type of objects you want the property to appear for. It works out the type your property will provide from the GetStatusMessage and its return type. I can send you an example I have that I wrote which provides a simple extender to a control. I was going to write it up as an article, but I dont haev time. -- David Wengier Sonork ID: 100.14177 - Ch00k

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups