Sounds Logical
Send Page To a Friend

Table Of Contents Previous Page Next Page

[M-Utilities overview]

M-Utilities: MATLAB function reference

winontop
Version 1.0 Requires MATLAB 6.0 (R12) or later

Make any window(s) permanently on top of all others (PC-Windows only). If applied to multiple windows, then the "aways on top" windows can be brought forward with respect to each other (e.g. using the mouse), but they will all be on top of all other windows not included in the call. Compatible with the MATLAB Compiler.

File format: m-file
Editable source code:
yes
Utilises non-editable functions: yes (mex dll, Windows API dll's)
Platform:
PC/Windows
Required MATLAB Toolboxes: none (except core MATLAB)
Demo version limitations: p-code only (cannot be compiled with the MATLAB Compiler)
Syntax:
 

winontop(Window);

  winontop(Window,Options);
Arguments:
Input:
Window

if numeric, the MATLAB figure handle of the MATLAB figure window to be affected. If non-scalar, all entries which are valid MATLAB figure handles will be affected.

otherwise must be a string containing the full or partial name of the window (MATLAB or non-MATLAB Window) to be affected.

Options

[Optional] argument only relevant when the Window argument is a title (sub)-string rather than a MATLAB handle. Must be structure containing (some of) the fields listed below. Note: if the argument is omitted or if a given field is omitted, the respective [default] values are used.

Options.IsFullName flag which, when set equal to 1, designates that Window contains the full name appearing in the titlebar of the window. Conversely, if the flag is set to 0 [default] this designates that Window contains only a portion of the full name string, thereby indicating that a search must be conducted (on all open windows) to determine the full name containing the partial string. Note: this
is particularly useful when the window under question corresponds to a console application whose full name contains a path which depends on the location of the executable (and can therefore vary arbitrarily
from installation to installation).
 
Options.CaseSensitive flag which designates whether the search based on Window should be case-sensitive (flag value of 1, [default]) or case-insensitive (flag value of 0).
 
Options.AllWindows flag which designates whether the search based on Window should return all windows which qualify (flag value of 1, [default]) or only the first qualifying window (flag value of 0)
 
 
This function utilizes a mex function (Windows DLL) called mexenablewin.dll which is a wrapper function around the Win32 API function SetWindowPos (with appropriate arguments to force the "on top" behaviour). The accompanying mexwinontop.m contains only the pragma %#mex which indicates to the MATLAB Compiler to expect a mex file rather than an m-file at compile-time.
  winenablewin    toggle window enable state
  winclosewin close window (designed for non-MATLAB windows)
  winshowwin    change window display ("show") state
Examples:
Create a demo figure:
  h=figure(1);
   
Make the window on top (using the MATLAB figure handle):
  winontop(h);
Delete original, then create two new figures:
  close(h); h(1)=figure(1); h(2)=figure(2);
Make both figures on top of all other (using their MATLAB figure handles)
winontop(h);
Delete original, then create two new figures:
  close(h); h(1)=figure(1); h(2)=figure(2);
Make both figures on top (based on their partial title strings, both containing the substring 'Fig')
winontop('Fig');
Set the flag to manipulate only the first window found
  Options.AllWindows=0;
Delete original, then create two new figures:
  close(h); h(1)=figure(1); h(2)=figure(2);
Only one of the figures will be put on top (i.e. the first found with 'Fig' in its name).
  winontop('Fig',Options);
Delete original, then create two new figures:
  close(h); h(1)=figure(1); h(2)=figure(2);
Set the flag to enable case-sensitive search of the name strings
  Options.CaseSensitive=1;
No action will be taken since the uppercase 'FIG' substring does not appear in either of the figure namestrings
  winontop('FIG',Options);
Put only figure(1) on top (based on its unique title string)
winontop('Figure No. 1');
Delete original, then create two new figures:
  close(h); h(1)=figure(1); h(2)=figure(2);
Set the flag to specify that full name expected (rather than partial)
  Options.IsFullName=1;
No action taken since 'No. 1' is not the full name
  winontop('No. 1',Options);
Put only figure(1) on top (based on its full title string)
  winontop('Figure No. 1',Options);
   
For an example on how to manipulate external (non-MATLAB) windows:
   
Open the default web browser at the Sounds Logical support area (requires internet access). The title of the browser window will contain the partial string 'Sounds Logical: M-Packs: Support'
  slmhelp -web;
Put the browser window on top (using the non-MATLAB-window title partial string)
  winontop('Sounds Logical: M-Packs: Support');

Top Of Page Table Of Contents Previous Page Next Page

Send Page To a Friend

home - news - products - store - support - site map - company info
© 2007 Sounds Logical. All rights reserved.
Sounds Logical
legal notice - privacy statement