LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

When printing graph, new control added to the graph did not show up

Instead of using PlotText function, I decided to use NewCtrl function to add text message into the graph. However, when printing the graph, NewCtrl did not show up. Could anyone help me?

I use NewCtrl because I can move the text to anywhere on the graph. Unlike PlotText, it's fix. By the way, I'm using LabWindows 6.0

- Ken
0 Kudos
Message 1 of 6
(2,879 Views)
I assume you are using PrintCtrl to print the graph. Since your text is now in a separate control, it won't print when printing the graph control alone. You would need to use PrintPanel instead of PrintCtrl to get both controls to print.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 6
(2,879 Views)
Thanks Chris. Well, is a trick you know of to make PlotText movable?

- Ken
0 Kudos
Message 3 of 6
(2,879 Views)
PlotText() returns a plot handle that you can use with DeleteGraphPlot() to selectively delete the text. So if you made a record of what had been plotted using PlotText() you could move it by deleting it and then plotting it somewhere else. A bit limited, though, if you want to move the text interactively.

Another trick is to do what you originally did, but put the graph on a borderless child panel within the main panel (so there are no visual clues that the child panel exists). If you then put the other controls on the child panel, you could do a print panel on the child panel and only the graph and the text controls you have added will be printed.

Martin.
--
Martin
Certified CVI Developer
0 Kudos
Message 4 of 6
(2,879 Views)
Your trick is useful, but I would like to go beyond that. Here is what I'm doing:

1. Add text using NewCtrl for text message
2. Get X & Y position, which are integers from NewCtrl
3. Convert X & Y position into double by multipling 1.00

When print, I did the following

4. Get control value from NewCtrl
5. Delete NewCtrl
6. Add PlotText using the value and X & Y position, which is now should be double as data type.

Now, my problem is at #6. Everything work, except the text shift all the way to or the bottom left (your left). I wanted the position of PlotText to be exactly the same position as NewCtrl. I wonder is this possible? I would appreciate it if someone could point out what I'm doing wrong and maybe give me some tip.

Th
anks,
Ken
0 Kudos
Message 5 of 6
(2,879 Views)
Here is the sample code:

Add Text:
=========
PromptPopup ("Please Input Your Label", "Please Input Your Label", LabelBuff, 499);

controlID[count] = NewCtrl (panels[current].panel_handle, CTRL_TEXT_MSG, LabelBuff, eventData1, eventData2);

MakeMovableCtrl (panels[current].panel_handle, controlID[count], "", 1, 1, 1, 1);

getTextPosX[count] = eventData2 * 1.000000;

getTextPosY[count] = eventData1 * 1.000000;

count++;

Print Graph:
============
for (i = 0; i < count; i++)
{
GetCtrlAttribute (panels[current].panel_handle, controlID[i], ATTR_CTRL_VAL, &LabelBuff);

plotTextHandle[i] = PlotText (panels[current].panel_handle, PLOTPANEL_GRAPH, getTextPosX[i], getTextPosY[i], LabelBuff, VAL_MENU_META_FONT, VAL
_BLACK, VAL_TRANSPARENT);

}
0 Kudos
Message 6 of 6
(2,879 Views)