LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
MAPJ

Easy String concatenation like Java using '+' at least in API's like Message Box etc.

I was operating on Pop-ups,I felt need of feature like java.

 

In Java when we have display Message we can easily concatenate variable with message string by using '+' sign.

 

 

Ex.

    In LabWindows,when do message pop up,

  

   {

    int var = 3;

  

    MessagePopup("Message count","Message No : "+var);

    }

 

 

     such a feature should be there.otherwise we do some string operation then Display message like " Message No : 3".

 

    So it increases string operations and string operations gives problem in memory management.

 

So at least In API's such '+' sign for concatenation of string with variables should be available.

Even if it is C language supported.

 

7 Comments
tstanley
Active Participant

I don't think this would be possible while maintaining a C API.  What may be possible would be something like this where the pop up functions would be combined with the Fmt functions:

 

int MessagePopupFmt(char Title[], char Format_String[],...);

 

Allowing things like:

MessagePopupFmt("Notification", "%s<The measured voltage was %f +/- %f V.", value, valueerr); 

Untitled.png 

 

 

 

 

 

MAPJ
Member

Yes this solution will be good .hope it would be implemented!!!

Smiley Happy

 

LuisG
NI Employee (retired)
Status changed to: Under Consideration
 
Wolfgang
Trusted Enthusiast

Hi,

 

a more general message popup certainly can be convenient because right now probably everyone is using his own functions for formatting and display.

 

However, for consistency I would suggest the ANSI version, i.e. use the formatting options of sprintf instead of Fmt, see the discussion here

vix
Active Participant
Active Participant

I agree with Wolfgang and I kudo the ANSI version (sprintf and not Fmt)

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
MarcelK
Member

I'm sorry, I don't get it. This feature request is three lines of code you can write yourself, why wait for NI to implement it?

 

int __cdecl MessagePopupf(const char *title, const char *fmt, ...) 

{
    char msg[1024];
    va_list va;

    va_start(va, fmt);

    vsnprintf(msg, sizeof(msg), fmt, va);
    return MessagePopup(title, msg);
}

meetjack
Member

Is this solution available now??

Leslie Love
Java Example