From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Deactivating backspace key operation in richtext ctrl

In my project I have included 1 richtext ctrl and 1 string ctrl.The call back
functions of those 2 are given below.
For richtext ctrl the callback function is
int CVICALLBACK RichTextboxCB (int panel, int control, int event,        void *callbackData, int eventData1, int eventData2)
{
    int swallow = 0;
 char *arr;
    switch (event)
        {
        case EVENT_KEYPRESS:
   if(eventData1==97)   //for not displaying a
   {    
     swallow=1;
   }
   
            break;
        }
    return swallow;
}
For string ctrl the callback function is
int CVICALLBACK STRING (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
 int swallow = 0; 
 switch (event)
 {
  case EVENT_KEYPRESS:   
   if(eventData1==97)  //for not displaying a
     swallow=1;
   break;
 }
 return swallow;
}
Now through keyboard I can enter any entry without 'a'.But if I do the
samething for deactivating Backspace key(eventData1=512) the string control
works fine but it fails for richtext ctrl .Actually I need flat ctrl like
text message and cursor display in that ctrl.For string ctrl cursor display
is possible but flatness is not.For textmessage ctrl flatness is possible but
cursor display is not.For these I chose richtext ctrl .But now I am facing
this problem.Please suggest.
0 Kudos
Message 1 of 6
(3,084 Views)

If you choose a Classic Style Text String control, you can make it appear flat by changing its border colour to Transparant, in the UI editor. You may want to change its background colour to Transparant as well - this will make the control look exactly like a Text Message, except it is still a string so it can be edited and generates callbacks as usual.

JR

0 Kudos
Message 2 of 6
(3,082 Views)

Take 2: Perhaps make the background the same colour as the panel: if you set it to Transparant you get odd effects when editing the text.

JR

0 Kudos
Message 3 of 6
(3,078 Views)
I chose classic style Text string control.In the UI editor choosing paint tool
I can change the background color of the string ctrl to transparent(selecting
T).But for changing the border color no T(for transparent ) option is
coming.It is showing X.I am attaching one project here.Two Classic style
string controls are there.One is opaque(whose background isopaque) and the
other is Transparent(whose background is transparent).I could not convert the
border color to transparent.I have added one richtextbox also.I want string
ctrl flat like richtext ctrl.Please change it and forward it to me.
0 Kudos
Message 4 of 6
(3,061 Views)

Here your UIR file modified with transparent frame on the string control. I had to open it in CVI7 since I haven't version 8 on this computer: hope you can reopen it without problems.

A possible reason for the transparent color not being available can be that you are incorrectly pointing on the panel background instead of the control frame: a panel cannot have a transparent background and that's why this colour is disabled. The control frame is only 2 or 3 pixels wide, so it can be difficult to aim at it: if this is the case I suggest you to move to a lower screen resolution when doing this modification: the smaller is the screen size, the larger are the controls so it's easier to aim at their frame. When changing frame colours, I personally point to the lower frame border (the one coloured in light color) which is easier for me to aim at: even though, several times I happen to point to the panel instead ( Smiley Sad ) and I must move my pointer...



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 6
(3,056 Views)
Thanks Roberto for your help.This is the solution that I wanted.Thanks again.
0 Kudos
Message 6 of 6
(3,051 Views)