Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: menuframes - Constructor Up: widgets - Module Previous: multiscale.dismiss - Function


menuframes - Tool



Package display
Module widgets


Postscript file available

Tk widget to hide and expose a number of embedded frames on demand

include "menuframes.g"

Constructors
menuframes Construct a menuframes
Functions
Delete Delete a named frame
add Add a named frame and return the frame
disable Disable the menuframes
done Destroy ourselves
enable Enable the menuframes
state Return the state of the frames in a record
switch Switch the visible state of the menuframes



Description
This widget handles switching between a number of frames, controlled by a menu button. The widget is created with a parent frame and a specified menu button. Named frames may be added using the add function. Switching between these frames is possible either by issuing switch and delete commands on named frames, or by user interaction via the menu button.



Example
tmenuframes := function(exclusive=T) {

  prvt := [=];

  prvt.frame:=dws.frame(side='top');
  prvt.topmenubar := dws.frame(prvt.frame,side="left", relief="raised",
				     expand="x");
  prvt.filebutton := dws.button(prvt.topmenubar, "File",
				      relief="flat", type="menu");
  prvt.filebutton.shorthelp := 'Do various operations';
  prvt.filemenu := [=];

  prvt.filemenu['exit'] := dws.button(prvt.filebutton, 'Exit',
				      type='halt');
  prvt.filemenu['exit'].shorthelp := 'Exit this window: the tool is done and the window exits';
  
  prvt.windowbutton := dws.button(prvt.topmenubar, 'Windows',
				  relief='flat', type='menu');

  prvt.rightmenubar := dws.frame(prvt.topmenubar,side='right');
  
  prvt.helpmenu := dws.helpmenu(prvt.rightmenubar);
 
  prvt.windowmenu := menuframes(prvt.frame, prvt.windowbutton, exclusive=exclusive);

  myframe:=dws.frame(prvt.windowmenu.add('My frame'), relief='sunken');
  myframe2:=dws.frame(prvt.windowmenu.add('My frame #2'), relief='sunken');

  mylabel := dws.label(myframe, 'First frame');
  done := dws.button(myframe, 'Done', type='halt');
  whenever done->press do {
    prvt.windowmenu.delete('My frame')
    deactivate;
  }
  mylabel2 := dws.label(myframe2, 'Second frame');
  dismiss := dws.button(myframe2, 'Dismiss', type='dismiss');
  whenever dismiss->press do {
    prvt.windowmenu.switch('My frame #2', on=F);
  }

  prvt.windowmenu.switch('My frame');

  prvt.bottomframe := dws.frame(prvt.frame, side='right');
  prvt.donebutton := dws.button(prvt.bottomframe, 'Done', type='halt');
  whenever prvt.donebutton->press do {
    prvt.windowmenu.done();
    prvt.frame->unmap();
    val prvt := F;
  }

  return T;
}




next up previous contents index
Next: menuframes - Constructor Up: widgets - Module Previous: multiscale.dismiss - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15