Entity objects in MS propertyGrid

Posts   
 
    
stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 19-Apr-2005 21:53:42   

Is this possible? I find I am is a situation where it would be convienient to display the properties of an Entity class in the MS Property Grid (lazy coding - why re-invent the GUI?). When I do, however, it is grayed out and there is no way to examine the properties. I sthis possible - maybe with a little custom code or attributes?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 20-Apr-2005 11:08:47   

Normal fields should be editable in the property grid, as they're normal properties. How did you test this, by setting a collection as the active object to edit?

Frans Bouma | Lead developer LLBLGen Pro
stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 20-Apr-2005 14:21:48   

Background: Using SelfService, no changes to the generated classes yet.

Single form with the property grid on it. Gave it a class containing several properties, including a read/write property for the data entity object. The other properties of this containing class are editable but the entity object is disabled. Does the entity object have to be assigned directly to the property grid? Ie: should it be the only object on the grid? (I will try that today). Like I said, this is a convienience, not a requirement, so I am not going to pursue it with too much work, just yet.

stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 20-Apr-2005 19:46:54   

Further testing shows that if I do


...
pgErrorData.SelectedObject = mBioData;  (<< this is LLBLGen entity)
...

the entity's properties are shown read/write.

If I do


....
pgErrorData.SelectedObject = mErrorData.ErrorEntity; (<< this is the encapsulating object's  read/write property with the entity object)
....

then the entity object is not available for viewing.

stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 20-Apr-2005 20:31:08   

Oops. Mistyped the previous post.

If I assign the entity object directly to the property grid, it works fine, but if I assign the encapsulating object containing the same entity to the property grid, the entity is not selectable.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 20-Apr-2005 21:29:20   

stoneyowl wrote:

Oops. Mistyped the previous post.

If I assign the entity object directly to the property grid, it works fine, but if I assign the encapsulating object containing the same entity to the property grid, the entity is not selectable.

Aha! simple_smile That's indeed the case, as the property grid will then not show you the entity for editing, but just the type... greyed out.

You have to set the entity object directly.

OR add properties to the encapsulated entity which simply get/set the enclosed entity object's properties simple_smile

Frans Bouma | Lead developer LLBLGen Pro
stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 20-Apr-2005 21:45:32   

Well darn. disappointed

I had hoped to avoid that, since there are many differnt entities that may appear in that particular dialog.

I once heard that "the best reward for programming is the chance to do it again." I think I will go back to the client and explore alternatives.

stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 21-Apr-2005 19:51:15   

Solved it... this

http://www.codeproject.com/cs/miscctrl/bending_property.asp

works like a charm.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 21-Apr-2005 20:32:02   

Cool! Thanks for sharing, didn't know this trick! simple_smile

Frans Bouma | Lead developer LLBLGen Pro