Zum Inhalt

ExecuteDialog (Opus Funktion)

Beschreibung

Diese Funktion führt einen Dialog gemäss den angegebenen Definitionen aus. Displays an Opus dialog object modally and returns the result code.

Argumente

Name

Typ

Beschreibung

Dialog

object

Definition des Dialogs. Das Objekt sollte als Referenz (mit &) übergeben werden, damit im Anschluss auf die veränderten Inhalte zugegriffen werden kann.

Rückgabewert integer

the dialog result code (e.g. IDOK, IDCANCEL)

Beispiel

function ExecuteDialog_Statistics
{
  Lo_GroupList = GetSSB_RoomGroupList();
  Lo_RoomGroups = {"Array":[]};
  for (Li_i = 0;Li_i < Lo_GroupList.GetSize();Li_i++)
  {
    Lo_RoomGroups.Array.<{Li_i} := {"Type":"CheckBox", "ID":2000+Li_i, "Caption":GetSSB_RoomGroup_s_NameEntry(Lo_GroupList[Li_i]), "Checked":1};
  } /* for */

  Lo_Date = GetDateTimeObject(GetCurrentDateTime());
  Lt_Start = GetDateValue(Lo_Date.Year, Lo_Date.Month, 1);
  if (Lo_Date.Month == 12)
  {
    Lo_Date.Year++;
    Lo_Date.Month = 0;
  } /* if */
  Lt_End = GetDateValue(Lo_Date.Year, Lo_Date.Month+1, 1) -1.0;

  Lo_Dialog = {"Caption":"Auslastungsstatistik",
    "Control" : {"Type":"VDist", "Controls":
      [
        {"Type":"GroupBox", "Caption":"Datums- und Zeitbereich", "Control":
          {"Type":"HDist", "Controls":
            [
              {"Type":"VDist", "Controls":
                [
                  {"Type":"Text", "ID":1000, "Caption":"Datum von"},
                  {"Type":"DateTimeControl", "ID":1001, "DateTime":Lt_Start},
                  {"Type":"Text", "ID":1000, "Caption":"Zeit von"},
                  {"Type":"EditBox", "ID":1003, "Text":"07:00"}
                ]
              },
              {"Type":"VDist", "Controls":
                [
                  {"Type":"Text", "ID":1000, "Caption":"Datum bis"},
                  {"Type":"DateTimeControl", "ID":1002, "DateTime":Lt_End},
                  {"Type":"Text", "ID":1000, "Caption":"Zeit bis"},
                  {"Type":"EditBox", "ID":1004, "Text":"22:00"}
                ]
              }
            ]
          }
        },
        {"Type":"HDist", "Controls":
          [
            {"Type":"GroupBox", "Caption":"Raumgruppen", "Control":
              {"Type":"VDist", "Controls": Lo_RoomGroups.Array
              }
            },
            {"Type":"VDist", "Controls":
              [
                {"Type":"GroupBox", "Caption":"Status", "Control":
                  {"Type":"VDist", "Controls":
                    [
                      {"Type":"CheckBox", "ID":1005, "Caption":"Reserviert", "Checked":1},
                      {"Type":"CheckBox", "ID":1006, "Caption":"Gebucht", "Checked":1}
                    ]
                  }
                },
                {"Type":"GroupBox", "Caption":"Details", "Control":
                  {"Type":"VDist", "Controls":
                    [
                      {"Type":"RadioButton", "ID":1007, "Caption":"Mit Details", "Checked":1},
                      {"Type":"RadioButton", "ID":1008, "Caption":"Ohne Details", "Checked":0}
                    ]
                  }
                }
              ]
            }
          ]
        },
        {"Type":"HDist", "Controls":
          [
            {"Type":"Button", "ID":10, "Caption":"OK", "DialogResult":1},
            {"Type":"Button", "ID":20, "Caption":"Abbrechen", "DialogResult":2}
          ]
        }
      ]
    }
  };

  Li_Return = ExecuteDialog(&Lo_Dialog);

  if (Li_Return == 2)
  {
    main.Suppress = 1;
  } /* if */

  Lo_GroupSelectionList = IntArray(0);

  for (Li_i = 0;Li_i < Lo_GroupList.GetSize();Li_i++)
  {
    Control = GetControlObject(&Lo_Dialog, 2000+Li_i);
    if (Control.Control.Checked == 1)
    {
      Lo_GroupSelectionList.Add(Lo_GroupList[Li_i]);
    } /* if */
  } /* for */
  Control = GetControlObject(&Lo_Dialog, 1001);
  DateFrom = Control.Control.DateTime;
  Control = GetControlObject(&Lo_Dialog, 1002);
  DateTo = Control.Control.DateTime;
  Control = GetControlObject(&Lo_Dialog, 1003);
  TimeFrom = Control.Control.Text;
  Control = GetControlObject(&Lo_Dialog, 1004);
  TimeTo = Control.Control.Text;
  Control = GetControlObject(&Lo_Dialog, 1005);
  Reserved = Control.Control.Checked;
  Control = GetControlObject(&Lo_Dialog, 1006);
  Booked = Control.Control.Checked;
  Control = GetControlObject(&Lo_Dialog, 1007);
  Details = Control.Control.Checked;

  return ({"DateFrom":DateFrom,"DateTo":DateTo,"TimeFrom":TimeFrom,"TimeTo":TimeTo,
           "Details":Details,"Reserved":Reserved,"Booked":Booked,
           "Groups":Lo_GroupSelectionList,
           "Return":Li_Return});
};

Beispiel einer Dialogfunktion:

function ExecuteDialog_Statistics {   Lo_GroupList = GetSSB_RoomGroupList();   Lo_RoomGroups = {"Array":[]};   for (Li_i = 0;Li_i < Lo_GroupList.GetSize();Li_i++)   {     Lo_RoomGroups.Array.<{Li_i} := {"Type":"CheckBox", "ID":2000+Li_i, "Caption":GetSSB_RoomGroup_s_NameEntry(Lo_GroupList[Li_i]), "Checked":1};   } /* for */   Lo_Date = GetDateTimeObject(GetCurrentDateTime());   Lt_Start = GetDateValue(Lo_Date.Year, Lo_Date.Month, 1);   if (Lo_Date.Month == 12)   {     Lo_Date.Year++;     Lo_Date.Month = 0;   } /* if */   Lt_End = GetDateValue(Lo_Date.Year, Lo_Date.Month+1, 1) -1.0;   Lo_Dialog = {"Caption":"Auslastungsstatistik",     "Control" : {"Type":"VDist", "Controls":       [         {"Type":"GroupBox", "Caption":"Datums- und Zeitbereich", "Control":           {"Type":"HDist", "Controls":             [               {"Type":"VDist", "Controls":                 [                   {"Type":"Text", "ID":1000, "Caption":"Datum von"},                   {"Type":"DateTimeControl", "ID":1001, "DateTime":Lt_Start},                   {"Type":"Text", "ID":1000, "Caption":"Zeit von"},                   {"Type":"EditBox", "ID":1003, "Text":"07:00"}                 ]               },               {"Type":"VDist", "Controls":                 [                   {"Type":"Text", "ID":1000, "Caption":"Datum bis"},                   {"Type":"DateTimeControl", "ID":1002, "DateTime":Lt_End},                   {"Type":"Text", "ID":1000, "Caption":"Zeit bis"},                   {"Type":"EditBox", "ID":1004, "Text":"22:00"}                 ]               }             ]           }         },         {"Type":"HDist", "Controls":           [             {"Type":"GroupBox", "Caption":"Raumgruppen", "Control":               {"Type":"VDist", "Controls": Lo_RoomGroups.Array               }             },             {"Type":"VDist", "Controls":               [                 {"Type":"GroupBox", "Caption":"Status", "Control":                   {"Type":"VDist", "Controls":                     [                       {"Type":"CheckBox", "ID":1005, "Caption":"Reserviert", "Checked":1},                       {"Type":"CheckBox", "ID":1006, "Caption":"Gebucht", "Checked":1}                     ]                   }                 },                 {"Type":"GroupBox", "Caption":"Details", "Control":                   {"Type":"VDist", "Controls":                     [                       {"Type":"RadioButton", "ID":1007, "Caption":"Mit Details", "Checked":1},                       {"Type":"RadioButton", "ID":1008, "Caption":"Ohne Details", "Checked":0}                     ]                   }                 }               ]             }           ]         },         {"Type":"HDist", "Controls":           [             {"Type":"Button", "ID":10, "Caption":"OK", "DialogResult":1},             {"Type":"Button", "ID":20, "Caption":"Abbrechen", "DialogResult":2}           ]         }       ]     }   };   Li_Return = ExecuteDialog(&Lo_Dialog);   if (Li_Return == 2)   {     main.Suppress = 1;   } /* if */   Lo_GroupSelectionList = IntArray(0);   for (Li_i = 0;Li_i < Lo_GroupList.GetSize();Li_i++)   {     Control = GetControlObject(&Lo_Dialog, 2000+Li_i);     if (Control.Control.Checked == 1)     {       Lo_GroupSelectionList.Add(Lo_GroupList[Li_i]);     } /* if */   } /* for */   Control = GetControlObject(&Lo_Dialog, 1001);   DateFrom = Control.Control.DateTime;   Control = GetControlObject(&Lo_Dialog, 1002);   DateTo = Control.Control.DateTime;   Control = GetControlObject(&Lo_Dialog, 1003);   TimeFrom = Control.Control.Text;   Control = GetControlObject(&Lo_Dialog, 1004);   TimeTo = Control.Control.Text;   Control = GetControlObject(&Lo_Dialog, 1005);   Reserved = Control.Control.Checked;   Control = GetControlObject(&Lo_Dialog, 1006);   Booked = Control.Control.Checked;   Control = GetControlObject(&Lo_Dialog, 1007);   Details = Control.Control.Checked;   return ({"DateFrom":DateFrom,"DateTo":DateTo,"TimeFrom":TimeFrom,"TimeTo":TimeTo,            "Details":Details,"Reserved":Reserved,"Booked":Booked,            "Groups":Lo_GroupSelectionList,            "Return":Li_Return}); };

Siehe auch