Drawing to Igor window from XOP
turnertechnology
However, I could not find either XOP draw text/lines/etc. callbacks that would allow me to tell Igor to add something to the window or a hook to the OnPaint (or equivalent) message.
My current purpose is for debugging my XOP. However, this would be of use in general as well.
Am I missing something, or is this not possible?
Thanks.
Sample code in a standard XOP function:
<br />
// The window's name is provided through a function parameter and stored in graphName<br />
// Get the correct child window of Igor. In this case, it is an Igor graph window <br />
CWindow mdiwin = IgorClientHWND();<br />
CWindow graphwin = ::FindWindowEx(mdiwin, NULL, _T("IgorGraphChild"), graphName));<br />
<br />
// Ensure that we have a window to work with<br />
if (graphwin.IsWindow())<br />
{<br />
// Get a device context, font, and other drawing objects to work with<br />
CDC dc = graphwin.GetDC();<br />
<br />
CRect r (0, 0, 100, 100);<br />
<br />
// Draw to the device context<br />
dc.DrawFocusRect(r);<br />
}<br />
// The window's name is provided through a function parameter and stored in graphName<br />
// Get the correct child window of Igor. In this case, it is an Igor graph window <br />
CWindow mdiwin = IgorClientHWND();<br />
CWindow graphwin = ::FindWindowEx(mdiwin, NULL, _T("IgorGraphChild"), graphName));<br />
<br />
// Ensure that we have a window to work with<br />
if (graphwin.IsWindow())<br />
{<br />
// Get a device context, font, and other drawing objects to work with<br />
CDC dc = graphwin.GetDC();<br />
<br />
CRect r (0, 0, 100, 100);<br />
<br />
// Draw to the device context<br />
dc.DrawFocusRect(r);<br />
}<br />
Using Igor 6.3.4.1. Windows 7. Developer Studio 10. WTL/ATL for window function (equivalent to MFC but uses CWindow instead off CWnd)
You can create your own window. This is described in the XOP manual.
However I think there are easier ways to debug such as using XOPNotice to write to Igor's history area or XOPCommand to create and write to an Igor window using Igor commands.
October 1, 2014 at 08:58 pm - Permalink
I figured that it was not supported as written above. The XOPCommand is what I was looking for. I am familiar with the XOPNotice for sending text to the history window. The debugging has to do with position in the window, which is best seen by actually drawing a shape as needed.
Something like:
sprintf(cmd, "DrawRect /W=%s 0.1, 0.1, 0.2, 0.2", graphName.c_str());<br />
XOPCommand(cmd);<br />
gives me what i need.
thanks.
October 1, 2014 at 09:59 pm - Permalink