Back to the main page.

Bug 2856 - keyboard does not work using GUI from ft_artifact_zvalue

Reported 2015-02-24 16:10:00 +0100
Modified 2016-06-17 15:58:11 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P5 minor
Assigned to: Jan-Mathijs Schoffelen
Depends on:
Blocks: 3118
See also:

- 2015-02-24 16:10:35 +0100

It seems that you recently start using Matlab R2014b and ask for possible remaining bugs due to the new graphics. I just noticed one using the ft_artifact_zvalue when the cfg.artfctdef.zvalue.interactive is turn on ('yes'). Indeed, when I want to use the command buttons (such as go through the next trial or the next artifact) inside the GUI, I have the following error: No appropriate method, property, or field Key for class matlab.ui.eventdata.ActionData. Error in ft_artifact_zvalue>parseKeyboardEvent (line 1074) key = eventdata.Key; Error in ft_artifact_zvalue>keyboard_cb (line 675) key = parseKeyboardEvent(eventdata); Error using waitfor Error while evaluating UIControl Callback I don't have any other problems with the other GUIs. I hope it will help you to find the source of the bug.

Robert Oostenveld - 2015-06-05 14:05:42 +0200

On 04 Jun 2015, at 19:34, w.a.moessing@xxx wrote: while preprocessing my EEG data I encountered a bug with the keyboard-keys in the interactive mode of ft_artifact_zvalue.m. Essentially, the GUI could only be controlled by clicking with the mouse, not with the keyboard shortcuts. This has been reported before at I looked into it and changed a few lines of code. The attached version has fully functional mouse- and keyboard control. Unfortunately, I could only test it on Matlab 2015a in Ubuntu 14.04 and Windows 8.1, not in earlier versions. Nevertheless, everything seems to work fine and maybe it's of help to you and other Fieldtrip users. Changes to the most up-to-date version are: lines 47-60: Added keymappings to help lines 441+442: changed 'h=figure;' to 'h=figure('KeyPressFcn', @keyboard_cb); ' lines 688-705: Convert the keymappings so switch can use them. In addition I had to change some of the mappings because key combinations (i.e. shift+x, ctrl+x etc.) did not work. You can find these changes in lines 492-510 and 710-748. The also attached html is a result of visdiff() in Matlab and highlights the mentioned changes.

Robert Oostenveld - 2015-06-05 14:36:31 +0200

(In reply to Robert Oostenveld from comment #1) Hi Wanja, Thanks for the suggested fix. I have incorporated it in the code. It would be good to further investigate how to get the modifier keys to work (like ctrl and shift) in combination with the arrows, as that is more natural. Hence I will leave it open. But for now it works better than it used to do. svn cmac011> svn commit Sending ft_artifact_zvalue.m Transmitting file data . Committed revision 10437.

Mats van Es - 2015-07-13 16:03:10 +0200

(In reply to Robert Oostenveld from comment #1) Hi Robert, I tried the code in matlab2013a and matlab2014a on the cluster, but I get the following error when I click a button in the GUI (cfg.artfctdef.zvalue.interactive = 'yes';) However, the keyboard input does work. Note that both the keyboard and mouse work in matlab2015a for me as well. Attempt to reference field of non-structure array. Error in ft_artifact_zvalue>keyboard_cb (line 702) curKey=eventdata.Key; Error using waitfor Error while evaluating uicontrol Callback

Jan-Mathijs Schoffelen - 2016-05-11 16:41:37 +0200

I think this is related to bug 3118 and has been fixed