So here is where i am at....
I feel like i am trying to milk a cow using a D9 bulldoser.....that i drive with my feet......in a pitch black cave.....while on fire...
(maybe its just me)
i got it to work i think...
Code: Select all
int numbs = ((Neo.ApplicationFramework.Controls.Controls.Button)valueField).DataBindings.Count;
MessageBox.Show("000:" + numbs.ToString());
((Neo.ApplicationFramework.Controls.Controls.Button)valueField).DataBindings.Clear();
numbs = ((Neo.ApplicationFramework.Controls.Controls.Button)valueField).DataBindings.Count;
MessageBox.Show("010:" + numbs.ToString());
Neo.ApplicationFramework.Common.Data.DynamicBinding dynamicBinding1 = new
Neo.ApplicationFramework.Common.Data.DynamicBinding("Value", Neo.ApplicationFramework.Common.Data.DataItemProxyFactory.CreateProxy("Tags.B_CV22"), "Value", true, System.Windows.Forms.DataSourceUpdateMode.Never, Neo.ApplicationFramework.Common.Dynamics.VariantValueConverterCF.Default);
((Neo.ApplicationFramework.Controls.Controls.Button)valueField).DataBindings.Add(dynamicBinding1);
numbs = ((Neo.ApplicationFramework.Controls.Controls.Button)valueField).DataBindings.Count;
MessageBox.Show("020:" + numbs.ToString());
the above shows that the tag is there removed and then a new one added.... (start with a tag chosen in the UI
to anyone looking at this here is a human explanation of how tags are connected as far as i figured out:
the objects passed to you on the screen(sender and so on) are adapted and there are no way to get tag data from them... so you need to go back through the screen to the actual object using its name / pointer.
then u use what i can only describe as a C# chainsaw to get to the bindings... like so:
Code: Select all
//in the screen use this.Button7(or what ever name you have) but inside the object you can use sender, be sure to cast it.
var itemName = this.Button7.Name ;
Type typeOfThis = this.GetType(); // screen
FieldInfo thisFieldInfo = typeOfThis.GetField(itemName, BindingFlags.NonPublic | BindingFlags.Instance);
//MessageBox.Show( thisFieldInfo.GetType().ToString());
var valueField = thisFieldInfo.GetValue(this);
not sure how i got here.. but after many many hours of reading .type() prints it works...
valueField.DataBindings. add/remove/clear with change the tag linked on the object..
not sure yet how it changes the screen hooks and stuff. use at own risk