User
User

Reputation: 65931

CMFCPropertyGridProperty list of values?

Is there a standard way to hold a user editable list of values in a CMFCPropertyGridProperty? I'm thinking a string with semi-colon delimiter (that seems to be the windows standard). If I want an edit interface for this how would I build that?

Upvotes: 4

Views: 1554

Answers (1)

Aidan Ryan
Aidan Ryan

Reputation: 11589

One option:

You can inherit CMFCPropertyGridProperty and override HasButton, returning TRUE. This will cause an ellipsis ("...") button to appear in the right-hand side of the value field. Override OnClickButton to provide your user interface for editing the list of values. You can pop up a dialog with a list control and a way to add/remove/edit items in the list. Override FormatProperty to display the list of values in the value field, and override ResetOriginalValue and implement code to restore the value you are constructed with.

Another option:

Inherit CMFCPropertyGridProperty and override OnKillFocus. If the user-entered value violates the formatting that you allow (semicolon-separated list of integers, for example), pop up a warning and return FALSE to prevent the edit from being committed.

Upvotes: 3

Related Questions