SysQuake Miscellaneous Functions

cancel

Cancel an operation.

Syntax

cancel
cancel(false)

Description

In a handler, it is often useful to cancel the whole operation. Avoiding changing any variable is not enough, because it would leave a new set of variables which would make the Undo command not behave as expected. The cancel command tells SysQuake to cancel completely the operation, be it a menu handler or the sequence of mousedown, mousedrag and mouseup handlers. cancel throws an error; hence its effect will be catched if it occurs in a try block.

In the middle of a mousedrag operation, it may happen that the mouse cursor in over an invalid region, but the drag should not be canceled. cancel(false) cancels the current execution of the mousedrag or mousedragcont handler, keeping the current value of the output variables.

Example

if ~dialog('Do you really want to make the system unstable?')
  cancel;
end
closedLoopRoot = 2;

See also

try, error

clc

Clear the command-line window or panel.

Syntax

clc

Description

clc (clear console) clears the contents of the command-line window or panel.

See also

clf

dialog

Display a dialog box.

Syntax

dialog(str)
ok = dialog(str)
(x1,x2,...) = dialog(str,x10,x20,...)
(ok,x1,x2,...) = dialog(str,x10,x20,...)

Description

dialog(str) displays the string str in a dialog box with a button labeled OK, and waits until the user clicks the button.

With an output argument, ok=dialog(str) displays the string str in a dialog box with two buttons, labeled OK and Cancel, and waits until the user clicks one of them; the result is true if the user clicks OK and false if he clicks Cancel.

With more than one input argument and the same number of input and output arguments, (ok,x1,x2,...)=dialog(str,x10,x20,...) displays in a dialog box the string str, a text field with the value of the remaining input arguments separated by commas, and two buttons labeled OK and Cancel. The user may edit the values in the text field. If he clicks OK, the first output argument is set to true, and the remaining arguments are set to the new value of the expressions in the text field. Should the user click the Cancel button, ok is set to false and all the other outputs are set to an empty matrix. With one output argument less, (x1,x2,...)=dialog(str,x10,x20,...) returns the new values if the user clicks OK; otherwise, it throws a Cancel error, which may simplify menu handlers.

The syntax permitted for the expressions typed in the dialog box is a small subset of LME's. In addition to scalars, complex numbers (entered as 2+3j without the multiplication operator), arrays and strings, are authorized the addition and subtraction operators, the negation, the transpose and complex transpose, the matrix construction functions zeros, ones, and eye, and the range operator :. Functions struct, class and inline are also permitted to create structures, objects and inline functions respectively. If the expression typed by the user does not satisfy these rules, or if the number of comma-separated values is not equal to the number of expected arguments, the entry is rejected and the dialog box is displayed again. The user can always click the Cancel button to close the dialog box, whatever is typed in the entry field.

Examples

Simple alert box:

dialog(sprintf(['You cannot have more zeros than poles ',...
                '(currently %d)'], np));

Dialog box with OK and Cancel buttons:

if dialog('Do you really want to reset the weights?')
    w = [];
end

Two equivalent menu handlers:

function (num, den) = menuHandler1(num, den)
  (ok, num, den) = dialog('Numerator, denominator', num, den);
  if ~ok
      cancel;
  end
function (num, den) = menuHandler2(num, den)
  (num, den) = dialog('Numerator, denominator', num, den);

Caveats

Some simplified versions of SysQuake may not implement dialog. In this case, dialog does not display any dialog box and always returns false and empty values.

See also

cancel

hasfeature

Check if a feature is available.

Syntax

b = hasfeature(str)

Description

hasfeature(str) returns true if SysQuake supports the feature whose name is given is string str, and false otherwise (even if the feature does not exist in any version). Currently, the following feature is supported in some versions of SysQuake:

Feature nameDescription
fileio low-level file i/o (fopen etc.)

idlestate

Control the state of idle processing.

Syntax

idlestate(b)
b = idlestate

Description

idlestate(b) enables the periodic execution of the idle handler if b is true, or disables it otherwise.

With an output argument, idlestate gives the current state of idle handler execution.


Copyright 1998-2001, Calerga.

All rights reserved.