06-26-2023 05:08 AM
Hello,
my name is Mirko and I'm making an application with CVI.
My application consists in updating the content inside a textbox.
Information to be inserted inside textbox are very fast, but using SetCtrlAttribute instead of SetCtrlVal, the speed is very good.
Performance of app is OK, but I see that when I click on textbox, performance goes down; if I click again on other item out of textbox, performance goes up.
I tried in debug and release, but it doesn't change.
My application doesn't require to write anything (it is "indicator").
Is there any parameter I can adjust in order to have always a good performance ?
Sorry if my explanation is not so clear...
Thanks in advance
Mirko
Solved! Go to Solution.
06-26-2023 05:34 AM
try to update the text box from & separate thread
06-26-2023 05:52 AM - edited 06-26-2023 05:52 AM
Setting the UI object to indicator has no effect in this case since the user can always select the control and manipulate it someway (e.g. in order to select and copy the text inside).
In order to prevent this scenario you can install this as the textbox callback:
//--------------------------------------------------------------------------
//
// Function rejectFocus ()
//
//--------------------------------------------------------------------------
/// HIFN rejectFocus()
/// HIFN This function makes the user unable to click on the control
/// HIFN and select the text inside it
/// HIFN This function can be installed either inside the UI editor
/// HIFN or by calling InstallCtrlCallback
/// HIFN Standard parameters of a control callback
int CVIFUNC_C rejectFocus (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event) {
case EVENT_COMMIT:
case EVENT_RIGHT_CLICK:
case EVENT_LEFT_CLICK:
return 1; // Swallow the events
default:
break;
}
return 1;
}
06-26-2023 07:00 AM
Thanks Roberto, it works!