excel focus problems with custom RTD server (real time data)

S

S Guy

I have a worksheet with RTD formulas in it. When the real time data
changes, excel grabs focus. (ie. excel pops itself to the front) How
do I stop excel from grabbing focus?

I've seen a couple of posts that seem related, but I haven't found any
solutions:

http://groups.google.com/groups?hl=...PwP9VmDHA.2512%40TK2MSFTNGP09.phx.gbl&rnum=14

http://groups.google.com/groups?q=e...c2c15c$c6ee1940$d4f82ecf@TK2MSFTNGXA11&rnum=1


I've also run many tests and found some odd behavior:

If I create an excel workbook with only formulas that use the
bloomberg.rtd server, things seem fine (excel does not grab focus). I
can have hundreds of these formulas and dependent formulas, etc.

If I create an excel workbook that contains references to the rtd
server that I have written (in VC++), excel grabs focus when these
values change.

I have looked through the code for my RTD server very carefully, but I
can't seem to find any problems with it. It provides data to excel
through the standard RTD interface -- data comes in, I store it in a
set, I call UpdateNotify(), when excel has some spare cycles it calls
be back with RefreshData() and I give it the data in my set.

Any help / insight / workarounds would be appreciated.

BTW, I am using WindowsXP / Excel2002.

Thanks,
steven
 
S

S Guy

After a little more investigation, this seems to also be a problem
with the BLOOMBERG.RTD. Here is a quick sample:

cell A1: IBM
cell A2: =RTD("BLOOMBERG.RTD",,A1 & " Equity", "BID")
cell A3: =if( mod(100*A2,2)=0, na(), "ASK")
cell A4: =RTD("BLOOMBERG.RTD",,A1 & " Equity", A3)


You can also do something like:

cell A1: IBM
cell A2: =RTD("BLOOMBERG.RTD",,A1 & " Equity", "BID")
cell A3: =if( mod(100*A2,2)=0, RTD("BLOOMBERG.RTD",,A1 & " Equity",
"ASK"), "no rtd")

I can't find any documentation on microsoft's site or anywhere else
that says RTD can't support these use cases. I've talked to bloomberg
on help and they claim that BLOOMBERG.RTD does not support these use
cases. It seems like something that would be very common though. Any
thoughts?
 
S

S Guy

A little more investigation shows that this occurs ANY time you
attempt to use a dynamic topic in an RTD formula. I created a small
sample worksheet that randomly picks "Chair" or "Lamp" from Microsofts
"Wide World Importer" RTD example. Every time the topic changes,
Excel grabs focus. This behavior seems consistant with the other 2
threads that I linked in my origional post. Right now, TweakUI seems
like the best workaround, however it is only a work around. I need to
allow other business critical applications to take focus as needed.

Hopefully someone from Microsoft is reading this and will be able to
suggest a better fix. If there is not a fix for this problem, I don't
see many use cases where RTD will solve my real time data in excel
problems. RTD will become another instance of a good idea missing the
mark by just enough to make it almost useless.
 
S

sguy.yugs

I've gotten several emails regarding this post, so I figured I'd just
post my current work-around.

The general idea of the work-around is to set up proxy subscriptions.
For every dynamic topic that you want to have, you set up a proxy. To
do this, I had to add a couple of extra calls to my dll.

int GenerateProxyId(unique id) - This function generates a proxy id and
binds it to some unique info. For my unique info, I use the workbook
name + cell name of the thing that is calling GenerateProxyId. You
need to do this so that when you open multiple workbooks in the same
excel instance you don't get id conflicts between workbooks.

DateTime AttachData(proxyId, data) - This is a call that I use to
attach dynamic data to proxy ids. I return a DateTime because it is
kind of useful to know when the last time your dynamic topic changed.
I keep a hash of proxyId->last change time so that if AttachData gets
called and it is the same data or there is an error condition or
something, I can just return the last good date.

I also added a special branch through my code to look for a special
topic "proxy". So when I get a call like
=RTD("My.RTD",,"proxy",3,"#bar") In this case, I would see that it was
a special "proxy" topic using the proxyId 3. I would look up the proxy
data 3 and find something like "dynamic-foo" and then attach it to the
static part of the subscription "#bar" and get something like
("dynamic-foo", "bar"). By having the ability to combine static data
with dynamic data, you can save some proxy/attachData calls. For
instance, if you wanted to have 2 subscriptions (stock, "BID") and
(stock, "ASK) where stock was a dynamic value, you would just have the
following:

=GenerateProxyId("my workbook.xls", "A5") -- 3
=AttachData( 3, stock) -- 12:03:05
=RTD("My.RTD",,"proxy",3, "#BID")
=RTD("My.RTD",,"proxy",3, "#ASK")

* I use the # symbol to indicate weather the proxied data should go
#before or after# the static data.

That's about it as far as the solution goes. It's a very painful way
to do something that seems like it should be there out of the box. The
code gets pretty ugly too. With the static data + dynamic data
combining, you have to do several one to many mappings and reverse
mappings.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top