Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to loop through all Properties
Collapse
X
-
Thanks, Zeos! I ended up just typing in all my properties one by one though, instead of making a neat loop. Oh well... it works at least. :-)Originally posted by Zeos6 View PostYou can do this (loop through your properties) by implementing the ICustomTypeDescriptor interface and then using GetProperties().
Bryan
Leave a comment:
-
Yes, thank you I've been reading that already. But I think I need some construct that I don't yet know in c# in order to get the setter to be called regardless of whether the value changed or not. Something like [Bindable] maybe... I'm not sure. I'll have to see if I can find some c# code examples out there that do this.Originally posted by NinjaTrader_AdamP View Postcass,
Here is some more information on get and set : http://msdn.microsoft.com/en-us/library/w86s7x04.aspx
Thanks!
Leave a comment:
-
cass,
Here is some more information on get and set : http://msdn.microsoft.com/en-us/library/w86s7x04.aspx
Leave a comment:
-
OK -- yes a little experimentation and I see that Get is called every time the parameter field is displayed, even if you are just scrolling the parameter list up and down. It gets called a zillion times! So this may not do it for me. I need to have something called when the user exits that field, regardless of whether the value changed or not. The Set accessor is not the answer, apparently.Originally posted by NinjaTrader_AdamP View Postcassb,
This would be a C# feature unfortunately. Get/Set are both parts of C#.
Is there a FieldExit event or something I can use to do this?
Leave a comment:
-
cassb,
This would be a C# feature unfortunately. Get/Set are both parts of C#.
Leave a comment:
-
OK, thanks Adam!
I have a related question then... you'll notice that if you click on a parameter value and change it to something different and then hit Tab or Return, then the get/set accessors are called. However, if you click on a parameter value and change it to the same value it already was, then the get/set is not called. I have some code in the 'set' that I want called regardless of whether you changed the parameter value or not, as long as you clicked on it. Is this a NT limitation or a C# feature?
Thanks!
Bryan
Edit: Wait... maybe the "get" is called when you first access the parameter field? I could put my code into that instead of "set"... I'll try that first.
Leave a comment:
-
cass,
Unfortunately there is no way to do this via supported methods as these are separate variables, not arrays or lists.
You may find this useful however : http://en.wikipedia.org/wiki/Reflect...er_programming)
And this : http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx
Leave a comment:
-
How to loop through all Properties
Can you tell me what the internal structure is so I can write a For loop to go through all my public properties that are defined in the Properties region?
Thanks!
BryanTags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
578 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Leave a comment: