PropertyValueChanged event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David W. Simmonds

    #1

    PropertyValueChanged event

    I have a custom object that I use in a PropertyGrid as seen below. It
    presents an elipsis button that when clicked brings up a custom modal
    dialog. When I make a change in the property, the PropertyValueCh anged event
    never gets fired. I have other properties in the PropertyGrid that do fire
    the event. Is there anything special that I need to do to have the event
    fired?

    [System::Compone ntModel::Editor Attribute(__typ eof(CPictureEdi tor),
    __typeof(System ::Drawing::Desi gn::UITypeEdito r))]
    [System::Compone ntModel::TypeCo nverterAttribut e(__typeof(CPic tureConverter))
    ]
    [Serializable]
    public __gc class PictureObj : public
    System::Runtime ::Serialization ::ISerializable
    {
    private:
    CPicture* m_pPicture;
    public:
    PictureObj()
    {
    m_pPicture = new CPicture;
    }
    ~PictureObj()
    {
    delete m_pPicture;
    }
    PictureObj(Syst em::Runtime::Se rialization::Se rializationInfo *si,
    System::Runtime ::Serialization ::StreamingCont ext sc)
    {
    m_pPicture = new CPicture;
    SetObjectData(s i, sc);
    }
    void SetPicture(CPic ture* pic) { *m_pPicture = *pic; }
    CPicture* GetPicture() { return m_pPicture; }
    void GetObjectData(S ystem::Runtime: :Serialization: :SerializationI nfo
    *si,

    System::Runtime ::Serialization ::StreamingCont ext sc);
    void SetObjectData(S ystem::Runtime: :Serialization: :SerializationI nfo
    *si,

    System::Runtime ::Serialization ::StreamingCont ext sc);

    __property IPicture* get_Picture() { return m_pPicture->m_pImage; }
    __property void set_Picture(IPi cture* value) { m_pPicture->m_pImage =
    value; }
    __property System::String* get_ImageExt() { return new
    System::String( m_pPicture->m_strImageExt) ; }
    __property void set_ImageExt(Sy stem::String* value) {
    m_pPicture->m_strImageEx t = value; }
    };



  • Earl Beaman[MS]

    #2
    RE: PropertyValueCh anged event

    Hi David,

    Is this the complete code? I don't see the event handler nor the event
    hookup. If you have those, please post them as well.
    If you don't have them, you need to get the event hooked up.

    Thanks,
    Earl Beaman
    Microsoft, ASP.NET

    This posting is provided "AS IS", with no warranties, and confers no
    rights.


    Comment

    • Natty Gur

      #3
      Re: PropertyValueCh anged event

      Hi,

      You need to create your own class that derived from UITypeEditor and
      override the EditValue method. In that method open the form and when you
      finish return the value to the Value parameter. You should also override
      the GetEditStyle to set the modal mode.

      This, at least, works for me.

      Natty Gur, CTO
      Dao2Com Ltd.
      28th Baruch Hirsch st. Bnei-Brak
      Israel , 51114

      Phone Numbers:
      Office: +972-(0)3-5786668
      Fax: +972-(0)3-5703475
      Mobile: +972-(0)58-888377

      Know the overall picture


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...