LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

EVENT_COMMIT fired not only by ENTER key

Hello,
 
I got a string control on a UIR which is connected to a callback function that handles the commit event. Now the problem is, that this event is fired not only by ENTER key but also when I press backspace, delete, escape, insert keys. This is not the behaviour I had expected!
 
If I make a new UIR with a similar string control in a new project everything is fine - EVENT_COMMIT is only fired by enter key...
 
Does anybody have an idea? Is there any project global setting?
 
Thanks
Steffen
0 Kudos
Message 1 of 11
(5,158 Views)
Just a guess. Is controlID the same in all the occurrences of EVENT_COMMIT? If not, you could have the same callback linked to other controls that have the corresponding shortcut keys set.


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 2 of 11
(5,145 Views)

Hi Roberto,

thanks for your answer. But unfortunately this is not the case. It's always the same control that is firing EVENT_COMMIT.

Steffen

 

0 Kudos
Message 3 of 11
(5,143 Views)

Hello Steffen,

seems little strange what is going on with your string control. The desired behaviour is as you described. After typing some characters and pressing <enter> the EVENT_COMMIT should fire if the control mode is set to Hot. If you only want to react to certain keys for the acknowledgement of the string input I would recommend using the EVENT_KEYPRESS event, as in this case the eventData1 contains the information about the button pressed.

int CVICALLBACK StringInput (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 char key[128];
 switch (event)
  {
  case EVENT_KEYPRESS:
  sprintf (key, "%c", eventData1);
  SetCtrlVal (panelHandle, PANEL_STRING_2, key);
   break;
  case EVENT_COMMIT:
   break;
  }
 return 0;
}

You could also post a snippet of code here that reproduces the behaviour, so we can take a more detailed look.

Regards,

CL

National Instruments Applications Engineering

0 Kudos
Message 4 of 11
(5,119 Views)
Maybe one could do a workaround by using EVENT_KEYPRESS but this is not what I want...
 
I could narrow the problem down to the following: Only if I load some TestStand ActiveX controls programmatically and get handles to them the problem occurs! If I comment out the following lines of code everything works fine:
 
******************************************************************************************************************************************************************************************
errChk( GetObjHandleFromActiveXCtrl(panelHandle,   gMainWindow.applicationMgrID,   &gMainWindow.applicationMgr));
errChk( GetObjHandleFromActiveXCtrl(panelHandle,   gMainWindow.sequenceFileViewMgrID,  &gMainWindow.sequenceFileViewMgr));
errChk( GetObjHandleFromActiveXCtrl(panelHandle,   gMainWindow.executionViewMgrID,   &gMainWindow.executionViewMgr));
errChk( GetObjHandleFromActiveXCtrl(panelHandle,   gMainWindow.statusBarID,     &gMainWindow.statusBar));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,   gMainWindow.runSequenceBtnID,     &gMainWindow.runSequenceBtn));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,   gMainWindow.entryPoint1BtnID,     &gMainWindow.entryPoint1Btn));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,   gMainWindow.entryPoint2BtnID,     &gMainWindow.entryPoint2Btn));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,  gMainWindow.currentSeqFileComboID,  &gMainWindow.currentSeqFileCombo));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,  gMainWindow.sequenceViewID,    &gMainWindow.sequenceView));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,  gMainWindow.currentSeqComboID,   &gMainWindow.currentSeqCombo));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab4,  gMainWindow.currentStepGroupComboID, &gMainWindow.currentStepGroupCombo));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.executionViewID,   &gMainWindow.executionView));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.currentSeqFileLabelExecID,  &gMainWindow.currentSeqFileLabelExec));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.currentSeqLabelExecID,   &gMainWindow.currentSeqLabelExec));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.currentStepGroupLabelExecID, &gMainWindow.currentStepGroupLabelExec));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.currentThreadComboID,  &gMainWindow.currentThreadCombo));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.currentExecutionComboID, &gMainWindow.currentExecutionCombo));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.breakOn1stStepID,    &gMainWindow.breakOn1stStep));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.breakOnFailureID,    &gMainWindow.breakOnFailure));
errChk( GetObjHandleFromActiveXCtrl(panelHandle_tab5,  gMainWindow.stepIntoBtnID,     &gMainWindow.stepIntoBtn));
 
******************************************************************************************************************************************************************************************
Does any of these controls cause the problem???
 
I'll try to post a sample... I cannot post the original code, but maybe I can reproduce the behaviour now.
0 Kudos
Message 5 of 11
(5,112 Views)

Hello Steffen,

you are right in saying that this is just a workaround. Thus we should try to find the reason which is of particular interest for us as well.

Meanwhile I have tried to get closer to the issue as well by using some TS ActiveX controls in my CVI-app as well. Unfortunately I haven't come across the behaviour you described so far.

I can get in contact with R&D regarding this issue as soon as we have more detailed information about this and a sample which reproduces the phenomenon.

Thus I would like to ask you for some more details.

Please let me know, I can then forward this to R&D for investigation. 

Regards,

CL

National Instruments Applications Engineering

0 Kudos
Message 6 of 11
(5,087 Views)
Dear Laemmermann,
 
I've tried to build an example that shows the same behaviour... but I couldn't succeed as well! It always functions... So it seems that I really have to provide the original code instead. In this case I would prefer sending the code directly to you via email and not publish it in the forum.
 
Could you send your mail adress to shmi at de dot festo dot com?
 
Regards
0 Kudos
Message 7 of 11
(5,047 Views)
Hi all,

The reason for this behaviour seems to be the TS_InsertCommandsInMenu-command. We are currently investigating this.
If you can leave out the command from your custom OI, the event commit is only fired when it should.

regards,
Norbert B.
NI Germany
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 11
(4,972 Views)
This problem has been fixed in the latest version of the CVI Runtime Engine.

http://digital.ni.com/softlib.nsf/websearch/47828729e9b3af8886257155007034b8

Allen P.
NI
0 Kudos
Message 9 of 11
(4,855 Views)

Great,

thanks for the information Allen.

Regards, Christoph

NI - Germany

0 Kudos
Message 10 of 11
(4,854 Views)