LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing object styles

Hi!!

I tried to execute the code below. The idea is to change the Knob style pressing one of the two command buttons (PANEL_MAIS and PANEL_MENOS) that are displayed. The callback function of both buttons is called teste.

The knob button displayed is an activex controller from cwui package (CWKnob Control from National Instruments).

The task is very simple, but I don't know why it is not working.

What is the problem?

Thank you in advance.

//interface.h
#define  PANEL                           1
#define  PANEL_CWKNOB                    2
#define  PANEL_MAIS                      3       /* callback function: teste */
#define  PANEL_MENOS                     4       /* callback function: teste */

-------------------------------------------------------------------------------------
//main.c
#include <cvirte.h>
#include "interface.h"

int g_intMainPanelHandle;
CAObjHandle ObjHandle;   
int aux = 5;
ERRORINFO *Error;

int main (int argc, char *argv[])
{
    if (InitCVIRTE (0, argv, 0) == 0)
        return -1;    /* out of memory */

    g_intMainPanelHandle = LoadPanel(0, "c:\\Documents and Settings\\gbolivei\\Desktop\\teste\\interface.uir", PANEL);
    DisplayPanel(g_intMainPanelHandle);

    GetObjHandleFromActiveXCtrl (PANEL, PANEL_CWKNOB, &ObjHandle);

    RunUserInterface();
    return 0;
}

int CVICALLBACK teste (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
{
    switch (event)
    {
        case EVENT_COMMIT:
            switch (control)
            {
                case PANEL_MENOS:
                    aux--;
                    CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, aux);
//                    CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, CWUIControlsLibConst_cwKnobStyleVLeftGauge);
                break;
                case PANEL_MAIS:   
                    aux++;
                    CWUIControlsLib__DCWKnob_CISetBuiltinStyle(ObjHandle, Error, aux);
                break;
            }
        break;
    }
    return 0;
}

0 Kudos
Message 1 of 7
(3,325 Views)
I am using LabWindows 8.1.1 and Measurement Studio 8.0.11
0 Kudos
Message 2 of 7
(3,311 Views)
Hi Oliveira,

I had no problems changing the style of the knob through the simple calls of

GetObjHandleFromActiveXCtrl (panel, PANEL_CWKNOB, &knobHandle);
status = CWUIControlsLib__DCWKnobSetBuiltinStyle (knobHandle, NULL, CWUIControlsLibConst_cwKnobStyleKnob);


I'm attaching my simple example project that I used to test it out.

See if this works on your end.

Best Regards,
    
Jonathan N.
National Instruments
0 Kudos
Message 3 of 7
(3,294 Views)
Hi  Jonathan!

It works perfectly, but I still in trouble while I try to use the 3D styles. I have an evaluation copy of measurement studio, and I don't know if these features (3D objects) only works in licence copies.

Thank you
Gustavo
0 Kudos
Message 4 of 7
(3,290 Views)
HI Oliveira,

The evaluation package for Measurement Studio doesn't have any limitations with regards to limited features. You should be able to use those 3D styles like normal.

Can you even change the style of the Knob at design-time? By that I mean, drop the Knob control onto your UIR, right-click the control, select Properties and change the style.

If that doesn't work, try opening up VB 6 or C++, drop that control and see if you can change knob styles. 

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 5 of 7
(3,285 Views)
Using LabWindows, it doesn't work even if at design time. I will try in VC++ and post some comments. If it works I will have a problem because I am using LabWindows CVI to develop my application and I don't want to migrate.

Thank you




Message Edited by Oliveira on 01-17-2008 02:21 PM
0 Kudos
Message 6 of 7
(3,282 Views)
Hi Oliveira,

You won't have to migrate to Visual Studio, I was just wanting to determine where the problem lies at (i.e. is it the Measurement Studio components or CVI).  The evaluation version issue might be causing problems. Did you happen to have a prior "licensed" copy of Measurement Studio on the system before you installed the eval? Has your eval run out (i.e. past the 30 day mark)? Can you r
un the ActiveX License Fixer to see what that says?

What actually happens when you select a 3d style in the User Interface Editor? Do you get some error?

The more I think about it, I believe the evaluation version might be playing some role here.

Best Regards,


Message Edited by Jonathan N on 01-17-2008 04:03 PM
Jonathan N.
National Instruments
0 Kudos
Message 7 of 7
(3,275 Views)