OBS/Makros und Scripting/Developer/Edits

Aus OBS Wiki
Version vom 22. Juli 2022, 08:02 Uhr von Thiel (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen


Beispiel

type
    TEventHandler = class
        {#EventDef}
        // procedure OnClick(Sender : TObject);

        procedure FrmObjEditEDInit(Sender: TObject);
        procedure FrmObjEditEDVorb(Sender: TObject);
        procedure FrmObjEditEDCheck(Sender: TObject; var lOK: Boolean);
        procedure FrmObjEditEDSave(Sender: TObject; cUNr: String);
    end;

var oEventHandler : TEventHandler;

{#CompDef}
var cbl_db_UT_SACHBEARBEITER : TCombiListe;
// var oLabel : TLabel;

procedure InitScripter();
begin

    oEventHandler := TEventHandler.Create();

    {#CompAssign}
    // oLabel := TLabel(FrmListe.FindComponent('oLabel'));

    cbl_db_UT_SACHBEARBEITER := TCombiListe(frmEdit.FindComponent('cbl_db_UT_SACHBEARBEITER'));

    {#EventAssign}
    // oLabel.OnClick := oEventhandler.OnResize;

    frmEdit.OnEDInit := oEventHandler.FrmObjEditEDInit;
    frmEdit.OnEDVorb := oEventHandler.FrmObjEditEDVorb;
    frmEdit.OnEDCheck := oEventHandler.FrmObjEditEDCheck;
    //frmEdit.OnEDSave := oEventHandler.FrmObjEditEDSave;

    //Idx();

    frmEdit.FrmObjEditEDRead(nil);

    frmEdit.Autosize := false;
    frmEdit.Width := 500;
    frmEdit.Height := 550;

end;

procedure TEventHandler.FrmObjEditEDInit(Sender : TObject);
begin
    // CBL-Zuweisungen, Komponenten freischalten/sperren,
    LCBL_Verk(cbl_db_UT_SACHBEARBEITER);
end;

procedure TEventHandler.FrmObjEditEDVorb(Sender: TObject);
var cNr : String;
begin
    // Felder füllen, die nicht automatisch von der db-Zuweisung gefüllt wurden
    if (frmEdit.lEditMode) then begin
        cNr := DB_NeuNumString(oDB, 'user_tische', 'ut_nr', NEUNUM_APPEND, '', '', '00000000', '99999999', '0', 8);
        frmEdit.xSet('ut_nr', cNr);
        cbl_db_UT_SACHBEARBEITER.Edit.Text := oApplication.cSachbearbeiter;
        cbl_db_UT_SACHBEARBEITER.Show.Text := DB_ReadSQLValue(FrmEdit.oEDB, 'S_VERK', 'v_name', 'v_nr = '+DB_SqlVal(cbl_db_UT_SACHBEARBEITER.Edit.Text));
    end;
end;

procedure TEventHandler.FrmObjEditEDCheck(Sender: TObject; var lOK: Boolean);
begin
    // darf gespeichert werden?
    lOk := true;
    if (lOk) then begin
        if (empty(frmEdit.xGet('ut_name'))) then begin
            lOk := false;
            Meldung('Bezeichnung darf nicht leer sein!');
        end;
    end;

end;

procedure TEventHandler.FrmObjEditEDSave(Sender: TObject; cUNr: String);
begin
    // Speichervorgang...
end;

</pre>

==Events==
<pre>
OnSetParent      : TNotifyEvent        (Sender: TObject)
OnVisible        : TNotifyEvent        (Sender: TObject)
OnScale25        : TNotifyEvent        (Sender: TObject)
OnDocking        : TNotifyEvent        (Sender: TObject)
OnSystemMenue    : TSystemMenueEvent   (Sender: TObject; nMsg: integer)

OnEDFormInit     : TNotifyEvent        (Sender: TObject)     
OnEDFormClose    : TNotifyEvent        (Sender: TObject)     
OnEDInit         : TNotifyEvent        (Sender: TObject)     
OnEDSave         : DefEditSaveEvent    (Sender: TObject; cUNr: String)
OnEDSaveAddOn    : DefEditSaveEvent    (Sender: TObject; cUNr: String)
OnEDRead         : TNotifyEvent        (Sender: TObject)
OnEDStable       : TNotifyEvent        (Sender: TObject)     
OnEDSaveDirect   : TNotifyEvent        (Sender: TObject)     
OnEDReadDirect   : TNotifyEvent        (Sender: TObject)     
OnEDAfterRead    : TNotifyEvent        (Sender: TObject)     
OnEDShow         : TNotifyEvent        (Sender: TObject)     
OnEDCheck        : DefEditCheckEvent   (Sender: TObject; var lOK: Boolean)
OnEDqSql         : TNotifyEvent        (Sender: TObject)     
OnEDVorb         : TNotifyEvent        (Sender: TObject)     
OnEdAddOnFields  : TNotifyEvent        (Sender: TObject)     
OnUseDBX         : TNotifyEvent        (Sender: TObject)     

OnF1Click        : TNotifyEvent        (Sender: TObject)     
OnF2Click        : TNotifyEvent        (Sender: TObject)     
OnF3Click        : TNotifyEvent        (Sender: TObject)     
OnF4Click        : TNotifyEvent        (Sender: TObject)     
OnF5Click        : TNotifyEvent        (Sender: TObject)     
OnF6Click        : TNotifyEvent        (Sender: TObject)     
OnF7Click        : TNotifyEvent        (Sender: TObject)     
OnF8Click        : TNotifyEvent        (Sender: TObject)     
OnF9Click        : TNotifyEvent        (Sender: TObject)     
OnF10Click       : TNotifyEvent        (Sender: TObject)     
OnF11Click       : TNotifyEvent        (Sender: TObject)     
OnF12Click       : TNotifyEvent        (Sender: TObject)     
OnPGUPClick      : TNotifyEvent        (Sender: TObject)     
OnPGDNClick      : TNotifyEvent        (Sender: TObject)     
OnESCClick       : TNotifyEvent        (Sender: TObject)     
OnReturnClick    : TNotifyEvent        (Sender: TObject)