LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need help with cosmetic changes of front panel

Solved!
Go to solution

we will learn some cosmetics
Ex 3-1.5aa+3.5aa^2-1000aa^20
As soon as you run the program or click outside the input area the input equation must change its form
3-1.5aa+3.5aa²-1000aa²⁰

And as soon as you click back into the input region the equation must turn back like 3-1.5aa+3.5aa^2-1000aa^20

 

I need to do the task mentioned above.

In order to do so, I planned to replace ^ with \B(replace ^2 with \B2 and ^20 with \B2\B0) but 

ankitk17_1-1623825433250.png

gets changed into

ankitk17_2-1623825480136.png

So I write \B in string constant and when I click outside that, I get \0B ( and his weird box when I set it to normal display).

I will appreciate any help in fixing this and also how to proceed ahead(i don't know how to make it work in the front panel) or if there is another way to this task and avoid the steps I was doing.

PS: I just started learning LabVIEW a couple of days ago, so, please explain the use of property node/ event structure /local variable or anything else we need in performing the above task.

Thanks a lot in advance.

 

0 Kudos
Message 1 of 12
(1,387 Views)

Hi ankitk,

 


@ankitk17 wrote:

So I write \B in string constant and when I click outside that, I get \0B ( and his weird box when I set it to normal display).

I will appreciate any help in fixing this and also how to proceed ahead(i don't know how to make it work in the front panel) or if there is another way to this task and avoid the steps I was doing.

PS: I just started learning LabVIEW a couple of days ago,


Did you notice those "Training resources" in the header of the LabVIEW board? There you can learn about all the basics of LabVIEW…

 

When I type "\B" in a string constant then it stays exactly like that when you click outside the string constant - atleast in "normal" display style!

However you seem to have changed the display style to "\-code" without making that visible in the string constant: now the behaviour changes a little bit and "\B" gets replaced by "\0B" (by design)…

 

Btw. why do you want to replace the caret by a VT ("vertical tab") control character? What do you want to achieve by the replacement? VT was used to move to the next line…

 

Idea: use a 2DPictureIndicator to draw your "cosmetically nice" formula…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(1,376 Views)

Hello GerdW,

Thanks for a super quick reply,

I didn't notice those "Training resources", I started looking for them after reading your reply.

I hope you are talking about LabVIEW Core 1 - 2020 Course - NI.

or please let me know if you meant something else with a link to training resources.

 

Now as I mention in my question, I want to make 3-1.5aa+3.5aa^2-1000aa^20 look like aa3-1.5aa+3.5aa²-1000aa²⁰.

ankitk17_0-1623833384092.png

here is the same equation displayed in \codes form and normal form respectively.

So, what I was trying to do is find the start position and end position of exponents(2 and 20) and replace ^ and add \B so that ^2 and ^20 converts into ² and ²⁰ (or \B2 and \B2\B0 in \code format).

And then find a property node to change the equation as I was asked to do in the mentioned task.

I am new to it, so I am not sure that it will work like that or not. I just want to make aa^2 look like aa² when the cursor is not inside the box and convert it back to aa^2 when we click on it to edit it. But for this, we need to read and write the same string, and as of now, I don't have any idea how can I do so.

I don't know a thing about "2DPictureIndicator". But I will try to learn about it more and implement it if it can help me with my task. Please let me know if you have any reference material for this.

Again thanks for your time and advice.

Best regards

Ankit Kumar

0 Kudos
Message 3 of 12
(1,340 Views)
Solution
Accepted by ankitk17

Hi Ankit,

 


@ankitk17 wrote:

ankitk17_0-1623833384092.png

So, what I was trying to do is find the start position and end position of exponents(2 and 20) and replace ^ and add \B so that ^2 and ^20 converts into ² and ²⁰ (or \B2 and \B2\B0 in \code format).


You didn't answer why you think the code "\B" will help you here? Can you supply a link to a website explaining the usage of that char?

How did you create the text in the "Equation 2" string?

What is the last char, which should be a "superscript zero"? It looks more like a "superscript lowercase o"…

 


@ankitk17 wrote:

please let me know if you meant something else with a link to training resources.


I meant the "Training resources" just in the top section of the LabVIEW board

 


@ankitk17 wrote:

I am new to it, so I am not sure that it will work like that or not. I just want to make aa^2 look like aa² when the cursor is not inside the box and convert it back to aa^2 when we click on it to edit it. But for this, we need to read and write the same string, and as of now, I don't have any idea how can I do so.

I don't know a thing about "2DPictureIndicator". But I will try to learn about it more and implement it if it can help me with my task. Please let me know if you have any reference material for this.


Idea:

  • Create a 2DPictureIndicator of the same size as your string control. Place it over the string control.
  • When the user clicks in the arey of the string/Picture you hide the picture and give focus to the string. Now the user can edit the string.
  • When editing is finished you convert the string to your desired "formula picture", display it in the 2DPictureIndicator, and make the picture visible again…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(1,333 Views)

Hi GerdW,

ankitk17_0-1623835619970.pngankitk17_1-1623835645819.png

How did you create the text in the "Equation 2" string?

-I just copy-pasted it.

why do you think the code "\B" will help you here?

-As I copy-pasted the equation, and viewed its \codes, I came to know that \B can be used to superscript any number, but I was wrong. I can only superscript no. 2 and no.3, for the rest of the numbers it shows some other characters and \B0 shows the degree symbol(i guess).

ankitk17_2-1623836159684.png

ankitk17_3-1623836201407.png

I was confused because \B2 was working fine for 2 and I thought this is how LabVIEW types superscripts 0.

After reading your recent reply I copied ¹²³⁴⁵⁶⁷⁸⁹⁰ and pasted, and this is what I got-

ankitk17_4-1623836622139.pngankitk17_5-1623836635448.png

It was a coincidence that I was provided with numbers 2 and 0, I guess. 

 

Thanks for the idea, I will try my best to use it how you suggested.

Best regards,

Ankit Kumar

 

0 Kudos
Message 5 of 12
(1,318 Views)

Hi Ankit,

 


@ankitk17 wrote:

It was a coincidence that I was provided with numbers 2 and 0, I guess. 


The only "coincidence" is the fact, that your computer uses the default (1252) Windows character table.

See this

 

You are also confusing "\B" with "\B2":

  • the first one is an incomplete input, which is why it is corrected to "\B0" in "\-code" display style
  • the 2nd one is a complete input, describing the byte B2h = 178d = char ²
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 12
(1,313 Views)
Solution
Accepted by ankitk17

Thanks for the information and idea, GerdW

But I was unable to use 2Dpicture to superscript the text(maybe my lack of knowledge), so I replaced it with a string indicator and it worked fine for me.

Here is the code attached.

 

Now my next step is to create different string indicators for a given array of Double complex numbers and remove the iota part from the string if a number is pure real and has no complex part. The number of string indicators must be smartly chosen, neither one less nor one more.

Thanks in advance.

Best Regards

Ankit kumar

0 Kudos
Message 7 of 12
(1,211 Views)

Hi Ankit,

 


@ankitk17 wrote:

But I was unable to use 2Dpicture to superscript the text(maybe my lack of knowledge),


"Superscript" can be simplified by "using smaller font, move chars to top line of normal sized chars"…

 


@ankitk17 wrote:

array of Double complex numbers and remove the iota part from the string if a number is pure real and has no complex part.


A complex number always has an imaginary part…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 12
(1,195 Views)

Hi GerdW,

"Superscript" can be simplified by "using smaller font, move chars to top line of normal sized chars"…

-That's what I used for the string indicator, I used a different font for superscripts only. I don't know how to print different fonts on a 2D picture, so for the 2D picture, the coefficients are also getting superscripted. So I used a string indicator with 2 different fonts.

 

A complex number always has an imaginary part…

- I know this, but I just want x+0.00000i to look like x only, i.e. remove the 0.00000i part when it's 0. That's what I meant by saying a purely real number that doesn't have 0.00000i term.

 

I don't know how to create a specific number of string indicators(not an array of strings) for a given complex number array. Please help me with this.

 

I also want to know how to use this-

ankitk17_0-1624530847534.png

 

and this-

ankitk17_1-1624530865615.png

 

Best Regards

Ankit kumar

0 Kudos
Message 9 of 12
(1,184 Views)

Hi Ankit,

 


@ankitk17 wrote:

I don't know how to print different fonts on a 2D picture, so for the 2D picture, the coefficients are also getting superscripted.


When using the DrawTextAtPoint function you can define the font, the font size and the position of the text…

 


@ankitk17 wrote:

I just want x+0.00000i to look like x only, i.e. remove the 0.00000i part when it's 0. That's what I meant by saying a purely real number that doesn't have 0.00000i term.


% checking absolute value of imaginary part of complex number
IF abs(im(complex)) < 1e-6 THEN
  FormatIntoString(re(complex))
ELSE
  FormatIntoString(complex)
ENDIF

@ankitk17 wrote:

I don't know how to create a specific number of string indicators(not an array of strings) for a given complex number array.


Why do you need so many string indicators?

(You can create as many as needed at edit time of your VI…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 12
(1,176 Views)