NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I fill the comment and percent complete

I'm using CVI. How can I fill in the comment and percent complete entries from my code?
0 Kudos
Message 1 of 12
(4,963 Views)
Hi,
take a look at this Example shipped with NI:  ...TSFOLDER...\Examples\DisplayingProgressAndStatus\UsingCVI
 
greetings
 Juergen
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 12
(4,955 Views)

I see this uses a UI message. This one works but I'm still trying to figure out how to create a custom control for this usage. I see the following from a help page:

http://zone.ni.com/devzone/cda/tut/p/id/4532

"Other messages can be sent by the programmer to update progress and status on the Operator Interface. When you post a message, you can send string data and/or numeric data with the message.

You can define your own events by using an event number that is greater than or equal to the value of the UIMsg_UserMessageBase constant (10000). There are two parts to using custom UIMessages:

    · Posting the UIMessage
    · Receiving and handling the UIMessage
    "

How can I assign an event number to an activex control that I create on the server side?

0 Kudos
Message 3 of 12
(4,939 Views)

HI Steve

I have added to the UI shipped with NI the ProgressText and a 10000+1 Message

See the attached Code

Greetings from the lake of Constance, Germany

juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 12
(4,926 Views)
Works so far. Thanks. Here is my next question? How do I post information from TextExec to report back to the DLL?
 
 
 
HRESULT CVICALLBACK ApplicationMgr_OnUIMessageEvent (CAObjHandle caServerObjHandle,
                              void *caCallbackData,
                              TSUIObj_UIMessage  uiMsg,
                              VBOOL *cancel)
{  
    char lpcstrBuffer[256];
    char *pCharBuffer;
    enum TSEnum_UIMessageCodes eventCode = 0;
   
    TS_UIMessageGetEvent (uiMsg, NULL, &eventCode);
    if(eventCode >= TS_UIMsg_UserMessageBase) {
       4; // My break point
    }
   
    if (eventCode == TS_UIMsg_UserMessageBase+1)    
    {  
       
        TS_UIMessageGetStringData(uiMsg, NULL, &pCharBuffer);
        sprintf(lpcstrBuffer, "I Have received Message:%s\0", pCharBuffer);
        TS_EngineDisplayMessageBox (gMainWindow.engine, NULL, "USER Message", lpcstrBuffer,
                                TS_MsgBox_Custom, 0, 0, NULL);
        GetStringData(uiMsg, NULL, &pCharBuffer);
        // This is where I would like to try posting back to the DLL.
 
    }
    else if(eventCode == TS_UIMsg_ProgressText){
//      TS_UIMessageGetStringData(uiMsg, NULL, &pCharBuffer);
//      SetCtrlVal(gMainWindow.panel,MAINPANEL_STR_PROGESS ,pCharBuffer);
    }
    else if(eventCode == TS_UIMsg_ProgressPercent ){
        // DO YOUR STUFF HERE  
       
    }
        // IF MORE USE A Switch/Case
   
   
    return 0;
}
0 Kudos
Message 5 of 12
(4,910 Views)
Hi,
 
Some years ago, i tried this with sending Messages to TS engine but this would not work well.
But now i do it with accessing the TS-Variables. Which is working well
 
Try this:
 
Greetings from the lake of Constance, Germany
 
juergen 
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 6 of 12
(4,897 Views)
But I'm doing everything without using variables. What is the equivalent of TS_UIMessageGetStringData that posts data so the function TS_EngineGetUIMessage can read it? This function returns an object instead of a string. How do I extract the string from the object? 
0 Kudos
Message 7 of 12
(4,892 Views)

Hi,

Question?

 where do you do  in your sequene the polling  of UI Messages. ?
Thread? Execution? Callbacks?

Please post a sample 

Greetings Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 12
(4,889 Views)
I do it in the DLL with three lines of code.
 
   local_err = TS_SeqContextGetExecution(teststand_data->seqContextCVI, &errorInfo, &execution);
   local_err = TS_SeqContextGetThread (teststand_data->seqContextCVI, &errorInfo, &thread);
   local_err = TS_ThreadPostUIMessage(thread, &errorInfo, TS_UIMsg_UserMessageBase+2, 0, ".", VTRUE);
 
I need to figure out how to use TS_EngineGetUIMessage or the equivalent of TS_ThreadPostUIMessage which lets me read.
0 Kudos
Message 9 of 12
(4,885 Views)
How can I do this in .net?
0 Kudos
Message 10 of 12
(4,774 Views)