07-26-2010 03:51 AM
I am having a Ring control with 4 different cases.
When A is chosen, i need to display an image named "A.jpg" in the front panel in Labwindows.
similarly for B, C & D.... "B.jpg","C.jpg","D.jpg"
Which function should i use here?
I tried something like this:
-----------------------------------------------
int CVICALLBACK READType (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
Png_ReadControlFromFile(PanelHandle, PICTURE, 0, "A.jpg");
break;
}
return 0;
}
--------------------------------------
i guess that is not the way. Can anyone help??
07-26-2010 05:43 AM
Hi,
first you should read the value of the ring control; here is a simplified example:
if ( event == EVENT_VAL_CHANGED )
{
GetControlValue ( panel, PANEL_RING, &selected_picture );
DisplayPicture... ( selected_picture );
....
}
07-26-2010 07:09 AM
Why not directly using a picture ring control? With this control you directly load pictures into it and associate values to them: the operator can choose the desired picture and program can directly read the associated value with GetCtrlVal; on the other hand, you can set the value with SetCtrlVal and the associated picture will automatically be displayed.
As ad additional hint, your use of Png_xxxx command makes me think you are using ReadSavePng instrument by Guillaume Dargaud: if you are using a quite recent version of CVI you can read / save to Png format with native controls: a png can be directly loaded into a picture or picture ring control or loaded into memory with DisplayImageFile or additional native commands.
07-27-2010 07:04 AM
Thnx guys.. I saw an example in the CVI foler where this same approach is taken. It uses GetCtrlVal & DisplayImageFile functions.
C:\...........\National Instruments\CVI2009\samples\userint\custctrl\combobox
the Png xxxx command was from ReadSavePng instrument by Guillaume Dargaud. I jus found tat one while searching.
Thank you very much guys.