Cancel
Showing results for 
Search instead for 
Did you mean: 

Subpart collection: programmatically control the User Edit option

Genius
Genius

Hi, could anybody help please.

I need to disable the Add-Delete-Copy choices in a grid. Can't find this setting.

 

image.png

 

 

[UPD]

The only problem I have: need somehow to  control programmatically the User Edit parameter of a Subpart Colletion

image.png

12 REPLIES

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Valued Contributor
Valued Contributor

Hi,

I don't know what version of RS are you using but in 8.13 and you have subpart linked to grid it's enough to uncheck "User Edit" option in Subpart definition.

 

I suppose for connection it's the same as it has similar option.

This setting does not impact editability of properties displayed in a grid.

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Genius
Genius

The version of Rulestream is 8.15.1 

The "User Edit" is unchecked. This doesn't work.

 

I want to add items to the grid by buttons or programmatically but not from context menu.

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Valued Contributor
Valued Contributor

Sounds like a bug as User Edit works as it should in 8.13.0.

So the only thing I can advice is opening GTAC request...

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Creator
Creator

It works for me (Rulestream 8.15.1).

And it looks like to be able to change this property programmatically you need to use this code (I didn't test this):

Subpart("...").UserChange = True

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Genius
Genius

Yes, my mistake. UserEdit checkbox works.
But finally I need to controll this checkbox programmatically. Cant find any good property or method.

UserChange() function mentioned by Kirill is not good here . It only returns boolean.

 

[upd] testing couple of ideas..

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Genius
Genius

nothing works... 

 

If anybody knows how to control the 'User Edit' parameter of a SubpartCollection programmatically please help.

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Pioneer
Pioneer

You cannot change the UserChange property. Also, note that there is no 'User Change Formula' - it is a static setting in architect. In other words, once you set the subpart to be static, it remains static and the ONLY way to change it is through the quantity formula. To do what you are trying to do, you must bind the grid to a readonly subpart but tie the 'Add/Delete/Copy' button (or any other button) to another subpart (dummy subpart) that is read-write. The readonly subpart will need to update its quantity based on the read-write subpart and its sub parts would get their values from the sub parts of the read-write collection. I know this is a round-about way and creates duplicate parts but there is no other way to do programmatically change the read-only character of a subpart collection.

 

Dharmesh

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Genius
Genius

Thanks for the response.

The duplicate SubpartColection doesn't look good for my situation. I need also to control some properties' values from the grid.

 

Trying to use Rulestream connection duplicating the Subpart.
User Edit checkbox is unmarked but the context menu is steal not blocked. This is weird Man Indifferent

 

 

image.pngzz.PNG

Re: Disable Add-Delete-Copy choices in the right click menu in a grid.

Pioneer
Pioneer

Are you absolutely sure you have the connection mapped to the grid and not the subpart by mistake? I just tried it and indeed the 'add' menu (and others) are disabled!

 

Dharmesh