OnKeyDown event to trigger RequestPrint for PowerChart component not working

Hi,

I am working with a Power Chart component. I wish there was a sliding Trace I want two things:

  • Print the view using component action.
  • X Trace to have values at the time of printing. X Trace only shows values when your mouse cursor is hovering over the chart. Can't print using a button because of this.

So, I have configured an onKeyDown event to trigger the RequestPrint action for the Power Chart. This way, whenever you have placed your mouse over the instant you want the X Trace to show values for on the table you can press a key and print the view. I don't think I am doing it right since it isn't working. I have added a script action to set the focus on the Power Chart component (self.focus()) because the onKeyDown event only triggers if it is in focus.

Thank you in advance for your help!

1 Like

If the onKeyDown event only triggers when the component is in focus, then placing a the self.focus() on the onKeyDown event won't trigger, and it won't gain focus...right?

You are right I have also tried onStart for the self.focus() script, that will not work either.

onStart for one component might fire before other components in the view are initialized and attempt to take the focus for themselves. Please vote for my suggestion of an onLoad handler that would fire once the entire view is done loading:

You might find success with a hack that uses a Timer to delay the focus request...

Good idea, I think you are right. I was able to fix this by wrapping the PowerChart on a Container and configuring the events on that container instead of the PowerChart. However, it will only work once, to make it work every time I had to use the onPointerMove event to trigger the self.focus() script.