Poser une questionPoser une question
 

TraitéeCMFCPropertyGrid

  • mercredi 4 novembre 2009 02:21PechFromTj Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    Hello, 

    Noob question, how can I link a CMFCPropertyGridProperty to a variable in my program? 
    I want a double var to be updated using the Properties Window.
    I've struggled understanding the DWORD_PTR value. I don't care about validation... I just want to change the value in the window and be it reflected in RAM.
    This is what I've done so far:
    1. Made a menu that will display a MessageBox with the value of the variable
    2. Added the Property to the PropertyGrid 

    I'm able to update it (supposedly) but when I display the value it stays the same.
    Thank you for your help..

Réponses

  • mercredi 4 novembre 2009 16:11hgn Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Traitée

    Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.

    The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.

    • Marqué comme réponsePechFromTj mercredi 4 novembre 2009 19:41
    •  

Toutes les réponses

  • mercredi 4 novembre 2009 03:07«_Superman_»MVPMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    I've struggled understanding the DWORD_PTR value.

    DWORD_PTR becomes a 32-bit unsigned value in a 32-bit build and a 64-bit unsigned value in a 64-bit build without changing any code.

    «_Superman_»
    Microsoft MVP (Visual C++)
  • mercredi 4 novembre 2009 06:15PechFromTj Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     
    Yeah, I kind of understand that part, but the thing is, how do I change the value of a variable using the CMFCPropertyGrid.

  • mercredi 4 novembre 2009 16:11hgn Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     Traitée

    Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.

    The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.

    • Marqué comme réponsePechFromTj mercredi 4 novembre 2009 19:41
    •  
  • mercredi 4 novembre 2009 19:42PechFromTj Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    Try to locate "MDITabsDemo" among the samples for VC2008SP1. In this sample CMFCPropertyGridProperty is used to update attributes in the application class.

    The parameter DWORD_PTR dwData is not the actual value to be edited but a ID-value you can pick up later with CMFCPropertyGridProperty::GetData(), for example in your handler of the message AFX_WM_PROPERTY_CHANGED in order to know what attribute has been changed.

    Thank you very much.... at least I have some code to analyze and try to understand! The wizard just gives you some code but that it's not linked to actual variables , but with the sample, I'm sure I'll figure out how it works.
    Thank you!

    I did a workaround, deriving my own PropertyGridCtrl and PropertyGridProperty, overriding the OnPropertyChanged adding some methods (overloaded) using pointers to the variables, it works ok, but I want to know how I'm supposed to do it using MFC methods. Once again, thank you!