text: #include <LgiWidgets.h>
  Inheritance diagram for GDialog:
  GDialog's can either be modal or modeless. A modal dialog blocks the user from accessing the parent GWindow until the dialog has been dismissed. A modeless dialog behaves like any other top level window in that it doesn't block the user accessing any other top level window while it's open.
  GDialog's can be created in two different ways. Firstly you can create code to instantiate all the various controls and add them manually to the GView::Children list. Or you can load all the controls from a resource file. The resource files are in XML format and there is a graphical tool LgiRes.
  Manual example:
  #define IDC_STRING 100 class Example : public GDialog { public: char *Str; Example(GView *p) { Str = 0; SetParent(p); GRect r(0, 0, 400, 300); SetPos(p); MoveToCenter(); Children.Insert(new GEdit(IDC_STRING, 10, 10, 200, 20, "")); Children.Insert(new GButton(IDOK, 10, 30, 80, 20, "Ok")); Children.Insert(new GButton(IDCANCEL, 100, 30, 80, 20, "Cancel")); } ~Example() { DeleteArray(Str); } int OnNotify(GViewI *c, int Flags) { switch (c->GetId()) { case IDOK: { Str = NewStr(GetCtrlName(IDC_STRING)); // fall thru } case IDCANCEL: { EndModal(c->GetId()); break; } } return 0; } };
  This example shows how to insert child widgets into the window and then process clicks on the buttons and finally return data to the caller via a public member variable. It is desirable to pass data using this method because a dialog could be running in it's own thread on some systems and therefor should not be accessing data structures outside of itself directly without locking them. If your main application' doesn't have thread locking in place for it's main data structures then accessing them from the dialog wouldn't be thread safe. This is mainly the case with the BeOS port of Lgi, but is good practise for the Windows and Linux ports for cross platform compatibility.
  The resource file method of creating dialogs is arguably the easier route to take once your've got it set up. Firstly create a resource file using LgiRes with the same name as your programs executable, but a different extension ("lr8"). When you call the GLgiRes::LoadFromResource function Lgi will automatically look for a file named after the running executable with the right extension and load it. Then it will find the dialog resource and instantiate all the controls specified in the resource. All the built in Lgi controls are supported directly as tags in the XML file and you can create your own custom controls that the resource loader can instantiate as well using the GViewFactory system.
  Resource file example:
  #include "Resdefs.h" // For the dialog defines class Example : public GDialog { public: char *Str; Example(GView *p) { Str = 0; SetParent(p); if (LoadFromResource(IDD_EXAMPLE)) { MoveToCenter(); } } ~Example() { DeleteArray(Str); } int OnNotify(GViewI *c, int Flags) { switch (c->GetId()) { case IDOK: { Str = NewStr(GetCtrlName(1)); // fall thru } case IDCANCEL: { EndModal(c->GetId()); break; } } return 0; } };
  This assumes you have created an lr8 file with the resource named 'IDD_EXAMPLE' in it.
  Now to actually call either of these dialogs you would use code like this:
  Example Dlg(MyWindow); if (Dlg.DoModal() == IDOK) { // Do something with Dlg.Str }
  The built in controls that you can use are: