Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've developed a macro that pops up a detail chart when a chart bar is clicked. The results look like this.
There is one user interaction case where the macro does not work correctly, and I haven't been able to fix it without breaking somewhere else. The problem is documented in the qvw and the macro source. Fundementaly, the issue is how to distingush between a clear from clear button and a clear made by clicking the bar when it is the only selected value.
If you enjoy working with macros and want to tackle this challenge, I'd appreciate some help on this.
The sample, and it's problem, currently works in V8.5 and V9.
Thanks,
-Rob
Rob,
I got a chance to read the notes a take a quick look inside. Didn't have enough time for a really good look, but I see what you mean. I'm thinking that the solution could be like this...
Create a one-field logical island, and a field has only one value. It could be either selected, or not. It will be selected by OnOpen macro, and can be cleared only by the Clear button. The fact that this field is cleared indicates that the Clear button was used. The field status can be checked by a macro, and later restored.
Rob,
Looks really interesting... It's a whole new world of possibilities.
(The main purpose of my reply is to get this thread in "my discussions" list and get back to it when I have time)
Well, now I'm thinking that it may (or may not) be possible to distinguish the clicks by checking in macro if the object is active.
Michael Solomovich wrote:distinguish the clicks by checking in macro if the object is active.
When you get a chance to read the notes in the qvw you'l see that this is the sticking point. I do rely on checking if the object is active. However it is possible for the document to be active and the clear button to be pressed. My macro can't tell the difference between this scenario and clicking the only bar in a chart.
-Rob
Rob,
I got a chance to read the notes a take a quick look inside. Didn't have enough time for a really good look, but I see what you mean. I'm thinking that the solution could be like this...
Create a one-field logical island, and a field has only one value. It could be either selected, or not. It will be selected by OnOpen macro, and can be cleared only by the Clear button. The fact that this field is cleared indicates that the Clear button was used. The field status can be checked by a macro, and later restored.
Rob, this is a very slick solution that open many new doors!
Michael - your suggestion is slick, too. We we'd really need is more triggers or more information about the current position of the pointer, but you are offering a nice work around.
I'm wondering if similar things could be achieved with the new "Actions" in ver. 9...
good stuff, folks!
Oleg
Michael Solomovich wrote:Create a one-field logical island, and a field has only one value
Thanks Michael. Great idea! Attached is the implementation of your suggestion. It works well.
I encountered another case that doesn't work right, when the user has preference "Click in chart background clears selectiion" checked on. If there is only one bar shown in the chart, clicking the chart background will pop the detail instead of clearing the field. This is because I can't tell if the actual bar was clicked (when I should pop detail) or the background (when I should clear).
Any ideas?
-Rob
Oleg Troyansky wrote:I'm wondering if similar things could be achieved with the new "Actions" in ver. 9...
As it is now, the macro works with V9 using the Action "Run Macro" -- same as before. I haven't looked to see if there is an opportunity to achieve the same effect easier or better with V9 features.
Oleg Troyansky wrote:We we'd really need is more triggers or more information about the current position of the pointer, but you are offering a nice work around.
An OnClick Event/Action would be really useful. Especially if it had access to both clicked object and the screen click position.
-Rob
Don't have any idea for this one. When I made the background click to clear the selection, the same clear hapened if click the bar. Don't see how to distinguish bar click from the background click. Really need more triggers.
Anyway, if not to use this user preference, it works very well. Let's consider that it's a "documented issue"...
Love this. Thank you Rob - and Michael!