in english whole site
Home·Programming·MatLab·Flag Dialogdeutsch·english·français
Contact & CommentsMinimizeHigherLower
» Visitor's comments
» Contact
» Hits: 1671  (details)
» Distinct visits: 139 (1 Hit/visit)
» Bots visits: 1532 (Hits: 91.7%)
» Your hits in this session: 1
Flag Dialog

CSE Flag Dialog v.1.1

GUI Dialog for user input

CSE Flag Dialog makes a GUI dialog to select from options of diverse types (checkboxes, radiobuttons, text-inputs and popup lists). Some options can be linked, i.e. be mutually exclusive or be only enabled according to the value of another option.
It is an extension of CSEOptionDialog.

Features and Usage

out = CSEFlagDialog(items)
out = CSEFlagDialog(items, title)
out = CSEFlagDialog(items, title, msg)
out = CSEFlagDialog(items, title, msg, options)

items is an array structure containing the options, in the following fields:
.name is a string (the name of the option)
.values is a cell array of possible answer:
if empty, it is considered to contain "Yes" and "No", i.e. the option is a checkbox or a radio-button.
if it contains only one numeric element, it is considered a header, and not an active control.
if it contains only one text element, it is considered to be a text input field, with the .values as default value.
Otherwise, it is a popup list with the choices given in values.
.linked [optional field] is an array of index in items indicating which options are linked with the option. Linked options will be grayed out when the option is set to "No".
If .linked contains negative elements, those will be grayed out when the option is set to "Yes".
.exclusive    [optional field] is an array of index in items indicating which options are mutually exclusive with each option. When the option is set to "Yes", mutually exclusive options are set to "No". If the field does not exist, or is empty, the control if a checkbox otherwise it is a radio-button.
Both .linked and .exclusive behaviour are only implemented for "Yes"/"No" fields - but any field can be in "linked" and will be grayed out.
.default [optional field] is an integer indicating the default value for each option (0: No, 1: Yes, -1: grayed out). Note that in the case of text input field, this field is irrelevant and the default is given in the "values" field; In the case of popup lists, the default is an index in .values, or -1 (grayed out).
"Linked" and "Exclusive" are NOT evaluated in the initial layout of the dialog, hence the default must be consequent with the rules, e.g. linked fields of a "No" field must be grayed out.
.indent [optional field] allows an indentation (proportional to the value of this field) from the position of the control. May be used to graphically make "groups" as no "frames" are used.
.help [optional field] contains tooltips help texts. Can contain "\n" to make multi-line help fields.
The other (optional) inputs are:
title is the window title (string)
msg is a string appearing on the top of the dialog
options is an optional structure containing options:
.center = 0|1 (center text msg)
.bold = 'light'|'normal'|'demi'|'bold': indicates how headers (see .values) must be printed out.
[more to come in future versions]

The controls will be display in the order they appear in items.

out contains an array of structure of answers:
out(i).answer = value of the control.
values are:
  • 1 or 0 for "Yes"/"No" controls,
  • the index of the chosen item for list controls.
  • the text given for text inputs.
out is empty if cancel was chosen, negative integer if error.

Version and download

Version 1.1 - Release 07.12.03 [
Legal Stuff]

Download the function as a .m matlab file (18 Kb).
Tested under R13 and R12 - no toolbox required.


items(1).name = 'Contact:';
items(1).default = 0;
items(1).values = {'email@address'};
items(1).help = 'Enter one of:\n- your email\n
    - your phone number.';
items(2).name = 'I will be coming!';
items(2).default = 1;
items(2).linked = [3 4 5 6];
items(3).name = 'With my family';
items(3).default = 1;
items(3).exclusive = 4;
items(3).indent = 1;
items(4).name = 'Alone';
items(4).default = 0;
items(4).exclusive = 3;
items(4).indent = 1;
items(5).name = 'Transportation:';
items(5).indent = 1;
items(5).values = {1};
items(6).name = 'Coming by';
items(6).default = 1;
items(6).indent = 2;
items(6).values = {'Train'; 'Bus'; 'Foot'};
items(6).help = 'Cars are polluting.\nUse public
items(7).name = 'I''ll sure give a phone call!';
items(7).default = 0;

title = 'Birthday party incsription';

msg = sprintf(['Dear friends,\nAs you all know,
  I am turning 30 next april.\nThis seems a worthy
  occasion to party a bit!\n\nWill you be able to

out = CSEFlagDialog(items, title, msg)

Legal blahblah & Conditions of use
© CSE - L.Cavin, 2003, 2004
These libraries and functions (THE PROGRAM) are provided "as is" without warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with the person downloading or running the program (THE USER). Should the program prove defective, the user assumes the cost of all necessary servicing, repair or correction.
In no event will the Author or the Copyright holder be liable to the user for damages, including any general, special, incidental or consequential damages arising out of the use, peruse or inability to use the program (including, but not limited to loss of data or data being rendered inaccurate or losses sustained by the user or third parties or a failure of the program to operate with any other programs), even if the Author or the Copyright holder has been advised of the possibility of such damages.
The fact of downloading or running the program implies acceptation of the present liability limitation by the user.
These libraries and functions are free to use for non-commercial purposes and can be distributed (free of charge) as long as the copyrights notices are kept intact. In particular, if the program is distributed further by the user, the user is responsible for including this legal warning and liability limitation to the distribution.
It is also encouraged to improve these functions; please send to the author any improvements - we may want to include them in this distribution under the same conditions.

Do not be afraid, I am confident that the program will work - without warranties of course ;-)
Thanks to the Free Software Foundation for inspiring this nice little legal blahblah... My favorite part is the "inability to use"... even if the "general, special, incidental or consequential" part is also quite fun!

Made with CSE_CMS, © CSE, 2008-2019