LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to change the colour of

my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.I am writing my program in a text box. I have to display few keywords which I am defining in a particular colour and all other text in black colour. It is as same as in C, C++ languages. If we are wring a C code in VC++, all the data declarations (like int, short etc.) will be displayed in blue colour. Similarly I want to display. I want to know how I can give different colour to different keywords in LabWindows. Please help me to solve this problem
0 Kudos
Message 1 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hello,
I'm slightly confused by your question, are you trying to change the color of keywords within the CVI editor as you are writing your program, or are you trying to change the color of certain words in a text box as your program is running?

Please clarify,
Ryan K.
NI
0 Kudos
Message 2 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hi

Thankyou for taking interest to clear my doubt. I want to change the colour of keywords within the CVI editor while I am writing my program. Also while opening the file those keywords should be in the defined colour. It should be as same as the C, C++ compilers. If we are writing a program in VC++, #include, int, short, etc., will be in blue colour. Also while opening any existing C file, those keywords will be in blue colour only.
Here i will define my own keywords and comments.
keywords should have one colour and comments should have another colour. Also it should be possible to change these colours from the menu.

Hope you got my doubt.
If not yet, if you are online anytime in any id, and if you let me know the timings, i will be online and expla
in you.

Thanking you
Joesam
0 Kudos
Message 3 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hi

I was confused when i posted u my reply to ur mail.
So i think that reply will confuse u also.
So please take this mail as my correct requirement.
I will explain u my requirement.

I have developed a compiler and interpreter.
I am developing a software where i have to build my programs using my compiler, which i have developed.
Also i will be writing new programs which i have to build.
So i am using a text box as the editor where i am writing the complete program or opening an existing program.
In that i will be having some keywords and comments, which i have to display in different colours, as in the case of C, C++ etc.
Here may be one of my keyword will be "NODE" and another will be "BLOC" as similar to "int" or "short".
So "NODE" or "BLOC" s
hould always be displayed in blue colour, unless and until the user changes the colour of the keyword from a menu. Similar in the case of comments also.

Hope now you got the complete idea of my problem.
Waiting to hear from you

Joesam
0 Kudos
Message 4 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hi Joesam,
Easily done, what you need is User Defined Tokens for Coloring. First make sure that Options->Syntax Coloring is checked. Next, Select Options->User Defined Tokens for Coloring and then click the Add button. Type in the name of the keyword you want to display in a certain color (you can do multiple keywords if you like, although they all have to be the same color). Finally, select Options->Colors and set the User Defined Tokens color to the color you want for your keywords.

That should do it,
Ryan K.
0 Kudos
Message 5 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hrm, the last explanation made sense to me, this one doesn't exactly make sense. Let me know if I didn't answer it.

Regards,
Ryan K.
0 Kudos
Message 6 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hi

Sorry for troubling you again .
The answer you have given is for defining a keyword and changing the colour in the CVI editor.
But i want to do the same thing in the application which i have developed.
So in my application i am using a text box as editor where i will be writing my code.
And i have defined a menu from where i have to do all the similar operations of defining the keyword and colouring it.

What i am doing now is, with the function SetCtrlAttribute(hAnalogPanel,PANEL_ALS_TEXTBOX,ATTR_TEXT_COLOR,fgColor); i am able to set the colour of the entire text in my text box. But i want to change the colour of few defined keywords only.

In short what i need is that, in my text box which i have developed using Labwindows, i
should have different texts or strings with different colours.

I dont know whether i was able to explain you my requirement.
Anyway thanking you again

Joesam
0 Kudos
Message 7 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Hi Joesam,

Okay, I finally get it :). And the answer is, unfortunately, no. I'm pretty sure you can't do it with a CVI text box. The whole textbox has to have the same color. About the only good way that I can think to get around this would be to embed an ActiveX textbox which has this capability (I played around with some other ideas such as floating other text boxes on top of the first, or using a table with one character in each cell instead of a textbox but ultimately decided that any such approach would be a nightmare). The Microsoft Forms TextBox control works the same as CVI in this regard, so I don't think it will help you, but you might be able to do it with the Microsoft Rich Text Control (I'm not sure, but it looks m
ore promising than the ordinary forms control). You could also search the web to see if anyone has written one, or write your own in VB or a similar language.

Regards,
Ryan K.
0 Kudos
Message 8 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Ryan

Thankyou very much.
I will try to do it as you have mentioned.
Anyway i have to make it some how.
Thankyou for your valuable suggestions.

Regards
Joesam
0 Kudos
Message 9 of 11
(4,575 Views)
my selected text string as in the case of C, C++ languages. I am writing a compiler and what i need is to display few keywords which i am defining in blue colour and all other texts in the edit box in black colour. Can anyone help me to solve this problem.Ryank

Hope remembering me.
I am the same person disturbed you some time back asking help for colouring strings in a textbox.
Now i am having a new requirement.
I want to have a Progress Bar in my application for indicating the progress of my task.
But in LabWindows I am not able to find a similar one.
I found a slider in the numeric controls, but not a progress bar.
Is there any way to implement a progress bar.
Also I found a lot of quries and answers in the discussion forums, but most of them are for LabView, whichwont be supported by LabWindows.
if you can give me some suggestions, it will be a great help.

Regards
Joesam
0 Kudos
Message 10 of 11
(4,575 Views)