OBS/Makros und Scripting/Developer/Listen

Aus OBS Wiki
Zur Navigation springen Zur Suche springen
type
    TEventHandler = class
        procedure EventF4Handler(Sender: TObject);
        procedure ShowStable(Sender: TObject);
        procedure InsertClick(Sender: TObject);
        procedure ReturnClick(Sender: TObject);
    end;

var oEventHandler : TEventHandler;
    oRich : TTextRichEdit;

procedure Idx2();
begin

    With FrmListe do begin

        ListNew();

        ListOrder         := 'ut_nr';
        aTabel[0]         := 'user_tische';

        InitColumn('Name'  , 'ut_nr' , 20, nil);
        AddColumn ('Nr'    , 'ut_name' , 5);
        AddColumn ('SB'    , 'ut_sachbearbeiter' , 5);

        ListShow('5288350197', FrmListe.Query, FrmListe.DBGrid);

    end;

end;

procedure InitScripter();
begin

    oEventHandler := TEventHandler.Create();
    frmListe.OnInsertClick := oEventHandler.InsertClick;
    frmListe.OnReturnClick := oEventHandler.ReturnClick;
    frmListe.OnShowStable := oEventHandler.ShowStable;

    oRich := TTextRichEdit(frmListe.FindComponent('riced1'));
    frmListe.PanShow.Visible := true;

    frmListe.InitButtons(nil);
    frmListe.EnableButtons(nil);
    frmListe.PaintButtons(nil);

    Idx2();

end;

procedure TEventHandler.InsertClick(Sender: TObject);
begin
    StartScripterEdit(oDB, 'UE_Tische', true, frmListe);
end;

procedure TEventHandler.ReturnClick(Sender: TObject);
begin
    StartScripterEdit(oDB, 'UE_Tische', false, frmListe);
end;

procedure TEventHandler.ShowStable(Sender: TObject);
begin
    oRich.Caption := frmListe.Query.A2C('ut_beschreibung');
end;

procedure TEventhandler.EventF4Handler(Sender: TObject);
begin
    //Meldung('Hi');
end;