The Panel Object

Synopsis

Class Name: Panel
Valid Parents: None - Panel is the top level
Valid Children: Menubar, Toolbar, Canvas, Command, Dialog

Description

The top level object which serves as the application main window.

  • The Panel object is created automatically and cannot be destroyed.
  • It is always called gsharp_1.
  • Although each of the Panel's children are optional, if they are created they will appear in the following order: Menubar, Toolbar, Canvas, Toolbar, Command.
  • The Panel's components can be managed using the object displayoption
  • If used, the Panel's Toolbars need to be registered with Gsharp like so:
  create Toolbar gsharp_1.TopToolbar
   ( XuNguiCreateFunction = "GuiSetCommandToolbarId",
     XuNguiDestroyFunction = "GuiDestroyCommandToolbar"
   );
  create Toolbar gsharp_1.BottomToolbar
   ( XuNguiCreateFunction = "GuiSetObjectToolbarId",
     XuNguiDestroyFunction = "GuiDestroyObjectToolbar"
   );
  • Any number of dialogs can be created

Inherited Resources

New Resources

Name Type Default
XuNguiTitle string "Gsharp 3.2"
  • The title of the Gsharp main window
Name Type Default
XuNguiCallback string undef
XuNguiCallbackData string undef
  • XuNguiCallback specifies the name of the function to call when the application exits. The callback reason is  XuCR_EXIT.
  • If XuNguiCallbackData is specified then the value is passed to the callback function in the second argument.
  • For more details - see Callback Functions

Example Code

  set gsharp_1
   ( XuNguiTitle = "My Application",
     XuNguiPosition = (0,0),
     XuNguiWidth = 200,
     XuNguiHeight = 400
   );
  create Menubar gsharp_1.MenuBar;
  create Menu gsharp_1.MenuBar.FileMenu
   ( XuNguiLabel = "File"
   );
  create Button gsharp_1.MenuBar.FileMenu.Open;

  create Toolbar gsharp_1.TopToolbar
   ( XuNguiCreateFunction = "GuiSetCommandToolbarId",
     XuNguiDestroyFunction = "GuiDestroyCommandToolbar"
   );
  create Icon gsharp_1.TopToolbar.Open
   ( XuNguiPixmap = "print.xpm"
   );

  create Canvas gsharp_1.ScrolledCanvas;

  create Toolbar gsharp_1.BottomToolbar
   ( XuNguiCreateFunction = "GuiSetObjectToolbarId",
     XuNguiDestroyFunction = "GuiDestroyObjectToolbar"
   );
  create Icon gsharp_1.BottomToolbar.Open
   ( XuNguiPixmap = "open.xpm"
   );

  create Command gsharp_1.command;

Return to Gsharp Applications Reference Manual