Back to the main page.

Bug 1966 - guidelines for the use of uicontrol and ft_uilayout

Status CLOSED FIXED
Reported 2013-01-31 15:26:00 +0100
Modified 2014-03-12 12:21:32 +0100
Product: FieldTrip
Component: documentation
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks: 648
See also:

Jörn M. Horschig - 2013-01-31 15:26:04 +0100

I plan to start using these functions for the moviefunction. Prior to that, it might be wise to settle on some conventions, which I see from ft_databrowser are absent. Let me propose some things (this needs some polishing and discussion before being put on the wiki): 1) if you want to configure a user interface (ui) in a figure, use uicontrol and ft_uilayout for setting it up. This helps to manage the different components. 2) keep ui definitions in one place at the code rather than scattering them around over several places. Some practical issues: 3) tags should have a sensible name to facilitate code readability (also: use tags - always) good: uicontrol('tag', 'channelui', ...); bad: uicontrol('tag', 'group1', ...); names should preferably be named according to function (e.g. 'channelui' or according to type ('buttonui') or position in the ui ('leftui'). 4) if it makes sense to group ui elements together, do it as early as possible - it makes life easier. do not retag otherwise! good: uicontrol('tag', 'channelui', ...); uicontrol('tag', 'trialui', ...) % do tag-specific stuff, e.g. ft_uilayout(h, 'tag', 'channelui', 'width', 0.10, 'height', 0.05); ft_uilayout(h, 'tag', 'trialui', 'width', 0.05, 'height', 0.05); % retag ft_uilayout(h, 'tag', 'channelui', 'retag', 'viewui'); ft_uilayout(h, 'tag', 'trialui', 'retag', 'viewui'); % do common stuff, e.g. ft_uilayout(h, 'tag', 'viewui', 'hpos', 'auto', 'vpos', 0); bad: uicontrol('tag', 'viewui', ...); uicontrol('tag', 'trialui', ...); % stuff that could have been done together ft_uilayout(h, 'tag', 'viewui', 'width', 0.10, 'height', 0.05); ft_uilayout(h, 'tag', 'trialui', 'width', 0.10, 'height', 0.05); % retag ft_uilayout(h, 'tag', 'trialui', 'visible', 'on', 'retag', 'viewui');


Jörn M. Horschig - 2013-07-03 10:58:31 +0200

added ui guidelines to the wiki: http://fieldtrip.fcdonders.nl/code_guidelines#graphical-user_interfaces_gui


Jörn M. Horschig - 2013-07-16 09:18:42 +0200

marking as resolved