LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Display of selected text

Hi,

is there a way to display highlighted text even if the text box is not in focus?

I am using active-x richtext box and EasyTab instrument, apparently even if i have set the last instruction to make the text box the active control, easy tab somehow makes the active control something else.

i need to see a particular string in the textbox to be highlighted at all times.

cheers
AL
0 Kudos
Message 1 of 7
(3,895 Views)
My first thought is that you may be better off setting the background color and/or text color (with SetCtrlAttribute) of your control to manage the highlighting you want.

Of course, if you want it active (in focus), not just highlighted, this won't do.

--Ian

Message Edited by Ian W on 04-11-2005 03:59 PM

Message Edited by Ian W on 04-11-2005 04:01 PM

0 Kudos
Message 2 of 7
(3,881 Views)
Hi Ian,

Don't think that is possible, because i have many lines in the textbox and i only want to select one particular line. I have tried "RichTextLib_IRichTextGetHideSelection (TextHandle, NULL, FALSE);" but this also dosen't seem to work very well.

Is there any way??

cheers
AL
0 Kudos
Message 3 of 7
(3,869 Views)
Sorry, but I'll have to leave it to someone more knowledgeable with the rich text library. Any takers?
0 Kudos
Message 4 of 7
(3,849 Views)
Hello AL,

Let me first verify the behavior you are seeing. Do you have a RichText control on one of the tabs or on a part of the panel not covered by the tab control? When you toggle between tabs, the text highlighted in the RichText control stops being highlighted. Does this happen when with all the tabs or only with certain ones? I seemed to have reproduced a similar behavior, but I want to check if this is what you are seeing on your side.

Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 7
(3,844 Views)
Hello AL,

If the behavior you are seeing is similar to what I am seeing, try the following procedure:

First get a handle to the Textbox control:
static CAObjHandle txtBox;
GetObjHandleFromActiveXCtrl (panel, PANEL_RTXBOX, &txtBox);

Then SET the rich text box to remember the highlighted state:
RichTextLib_IRichTextSetHideSelection (txtBox, NULL, VFALSE);

*** Notice that the call is to the Set function instead of the Get function. ***

Then load your easy tab, and any additional code:
EasyTab_ConvertFromCanvas(...);
EasyTab_LoadPanels(...);

When I do this, the highlighted text in the textbox keeps its state independent of whether or not I tab through different panels on the Easy Tab control.

Let me know how this works. Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 6 of 7
(3,839 Views)
Hi Wendy,

yes you are correct, my RichTextbox is on a panel not covered by the tab controls and when i toggle between the tabs the original highlighted text suddenly disappeared and i realise it is because the focus got lost on it. So i tried setting it to be the active control after a user action and it also dosen't seem to work very well coz i think the easytab instrument will run it's code after my codes end. After many times of the same action then the focus will be at the textbox control.

therefore i tried setting the rich text selection to false but apparently it dosen't seem to work coz i used the wrong command.... so careless of me. Anyway, yes your solution seems to have solved my problem and is working real fine. Thanks a million. You have helped me solve my problems once again!!!



err... actually i have another problem and maybe you could help me.

Do i need to install visual C/C++ in my computer to be able to use the richtext active x control??

Problem 1: Originally in a new .UIR, i tried inserting activeX>>microsoft rich textbox control 6.0 and i got an error: "ActiveX control error". I tried it on another pc and it works real fine. so i saved the .uir and bring it back to my pc it also can't work. After reinstalling and doing some other stuff, saving the uir and bringing it to my pc can work as in i can see the window on my pc and be able to write richtextbox commands in *.c.

Problem 2: I can't edit the richtextbox on my pc at all. If i just double click to try to get the menu, i will get a message "This ActiveX control does not support persistance. You will not be able to copy, edit or save this control."

Problem 3: When I save the .uir i will have a warning "this file contains one or more ActiveX controls that could not be loaded on this computer.....converted to indicator control.......make sure properly installed....if you save the file in this state, original contents will be lost." In short, i can't make any changes to the .uir be it in the same panel, different panels, different controls, etc..

Problem 4: not able to see any help for any rich text commands.

I found out that it might be becuase that i do not have Visual C/C++ installed because the other pc has it and is able to edit the .uir and view help for the commands and all...

Is this the reason?


Cheers
AL
0 Kudos
Message 7 of 7
(3,831 Views)