LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

image display using Ring Control in Labwindows

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??

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 1 of 4
(3,663 Views)

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 );

        ....

    }

0 Kudos
Message 2 of 4
(3,649 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,643 Views)

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.

 

 

Nghtcwrlr

---------------------------------------------------------------------------------------------
*************************************
---------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 4
(3,610 Views)