HighTechTalks DotNet Forums  

globalItems for properties don't get updated?

Dotnet VSA microsoft.public.dotnet.vsa


Discuss globalItems for properties don't get updated? in the Dotnet VSA forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Nolan Woods
 
Posts: n/a

Default globalItems for properties don't get updated? - 08-15-2005 , 05:58 PM






Hi,

I'm working on a scriptable project and I'd like to have a property
external to the scripting engine be readable as a global variable.

However, the property's get is only accessed the first time, from
GetGlobalInstance, and after that the global variable in the script is
constant, instead of reflecting the current value of the property.

Is there any way to do this without having to reference the property
through another object (e.g., making m_project a global and having the
script use m_project.NumTurns)?

I've tried boxing and of course that did nothing. I tried making
NumTurns be an object of a special class, that requests
m_project.NumTurns when its conversion operator is called, but VB.NET
doesn't support operator overloading, so that didn't help any.


For example:
/************************************************** *************/
scriptengine = new Microsoft.VisualBasic.Vsa.VsaEngine();
....
globalItem = (IVsaGlobalItem) items.CreateItem("NumTurns",
VsaItemType.AppGlobal, VsaItemFlag.None);
globalItem.TypeString = "System.Double";



.....

public object GetGlobalInstance(string name) {
switch(name) {
case "SimTime":
return m_project.NumTurns
default:
return null;
}
}
/************************************************** *************/

Thanks, and I really hope someone can help,

- Nolan Woods


Reply With Quote
  #2  
Old   
Nolan Woods
 
Posts: n/a

Default Re: globalItems for properties don't get updated? - 08-15-2005 , 06:01 PM






Quote:
case "SimTime":
return m_project.NumTurns
"SimTime" should of course be "NumTurns". (d'oh.)
But that's not the problem.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.