In a MetaClass (we have) several customized MetaAttributes which are opened to a user to be filled except if the instance of this Metaclass is linked with a "reference" then these several MetaAttributes won't be available yet to be editing ...
The MetaAttributes will be virtual ones associated to a macro ..
In this macro can we change "on the fly" the editing properties of a field in a Property Page (to be triggered from 0x2 to 0x207) ?
It is sure that this property is defined on the MetaAtrtibute and compiled but otherwise can we change it ?
Solved! Go to Solution.
I'm not sure that modifying edition option "on the fly" is possible.
But instead of using virtual metaAttributes, you could use standard (i.e. "Intrisic") metaAttributes with a MetaAttributeUpdateTool macro.
You would then write your macro as follow :
Function AttCtl_GetDefaultKind() As String AttCtl_GetDefaultKind = "Edit" End Function Function AttCtl_Update(Context, Status, ErrorMessage) Dim myObject Set myObject = Context.megaobject if <condition if linked to a reference> Then if Context.EditText <> myObject.getProp("<your metaAttribute>") then 'the attribute has been modified ErrorMessage = "You are not allowed to modify this Attribute because..." Context.EditText = myObject.getProp("<your metaAttribute>") 'to go back to the "previous" value end if end if End Function
I'm not sure if that answers your question, but I hope so 🙂
Yes indeed, I can check the compliancy and integrate an update in it.
I have found in a macro this synthaxe :
Function AttCtl_GetDefaultKind() As String
AttCtl_GetDefaultKind = "CheckBox"
Function AttCtl_GetKind(oContext As MegaUpdateToolContext) As String
if oContext.MegaObject.GetProp("~ekbhT6B2DDQM[DestroyColl.Status]") = "P" Then
AttCtl_GetKind = "Static:ReadOnly"
AttCtl_GetKind = "CheckBox"
I have to try it in my case but it seems to control if an Edit field or a ComboBox can be used or is read only ! ?
Tried: yes it is piloting "on the fly" if the field is available to be written or "read only".
Last question: what is the equivalent of MetaAttributeUpdateTool for a MetaAssociation ?
I do not understand your need.
Do you want to enable link between two objects according to specific conditions, or do you want to enable (or not) metaAttribute modification depending on if the object is linked or not to another one ?
In the second case, you simply have to write your condition in the "AttCtl_GetDefaultKind" function :
If myObject.getCollection("myMetaAssocitionEnd").count > 0 Then
In the first case... well I do not know. Tell me if it is what you need and I will see if something is possible.
Yes it was the first case "enable link between two objects according to specific conditions".
I want to deactivate the connect/disconnect if a condition is satisfied.
I have seen several MetaAssociationEnd to connect a macro to a MetaAssociation or a MetaAssociationEn it's why i was wondering if it is possible ... i
I thought about it, but did not figure out how to do that.
I think you should create a new topic for that question (as this one is already marked as "solved") to see if someone else has an idea 🙂