Figure window created by .NET assembly not responsive to Data Cursor and Right Click
9 views (last 30 days)
Show older comments
Hi, I have created a MATLAB .NET assembly file and included it into a C# application. The purpose of one of the functions was to plot a figure of some calculated data and I'm having some issue with the figure window.
The plotting function looks similar to the following:
function out = FigureDemo(in, showFigure)
%% Default value for showFigure
if nargin < 2
showFigure = false;
end
%% Start Plotting
h = figure('visible', 'off','pos',[10 10 in.DefaultFigureWidth in.DefaultFigureHeight]);
% Here some data is drawn on the figure
%% Output
tightAxes(h); % removes white spaces
out = struct;
out.figure = getCSStructFromFigure(h); % converts the figure into pixels to be read by C# app
if showFigure == true
set(h, 'visible', 'on');
drawnow % this makes sure the window is visible
end
end
By changing the 'showFigure' variable, the function allows either plotting an invisible figure and passing the image as pixels to C# or plotting a visible figure as well as passing the image as pixels to C#.
I had some issue with Figure window showing up only after calling the function twice, and that was fixed by adding the "drawnow" line.
The problem I'm still experiencing is that the created figure window does not seem to refresh/update under certain circumstances:
- Zoom in, Zoom out, Pan and Rotation works fine. Figure is updated in realtime as the mouse is being dragged. However, the mouse cursor seems to only update after the mouse click is released. (e.g. After clicking the 'Pan' icon, the cursor remains a pointer. Only after you drag and release the figure will the cursor be changed to a 'Hand')
- Resizing the Figure window to a larger size would not cause the figure to resize, unless you click any of the toolbar icons or trigger a context menu in the plotting region.
- Similar to the sympton above, creating and dragging of a datatip does not cause the figure to update. (You either can't see the datatip or can't see it at its latest location) The update can only be triggered by clicking any of the toolbar icons or triggering a context menu in the plotting region.
- Even the context menu itself may not appear at the right location. (e.g. If you right click twice at different locations, the second time the context menu would appears at the previous location briefly before moving to the correct location)
Can someone please point out what could potentially be causing this problem?
Thanks a lot.
0 Comments
Answers (0)
See Also
Categories
Find more on .NET Methods in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!