Skip to main content
Skip table of contents

TVarCalcPanel

TVarCalcPanel

Klasse zur Anzeige des Varianten-Dialogs auf einem Panel.

Allgemeine-Eigenschaften

Eigenschaft

Beschreibung

FormVarCalc:O

Varianten-Dialog Formular (Objekt vom Typ TFormVarCalc)

DataSource:O

DataSource Objekt

DataField:C

Feld zu Varianten-Array (z.b. SL_Memo Feld)

ArtNo:C

Artikel-Nummer (entspricht FormVarCalc.ArtNo)

PurchPrice:N

Einkaufs-Preis (erst während und nach dem Event OnCalcReady gefüllt)

SalesPrice:N

Verkaufs-Preis (erst während und nach dem Event OnCalcReady gefüllt)

ReadOnly:L

nur Lese-Modus (wird ignoriert falls DataField/DataSource gesetzt ist) (entspricht FormVarCalc.ReadOnly)

Modified:L

 (nicht aktiv) (entspricht FormVarCalc.Modified)

Aktive-Eigenschaften (Methoden)

Eigenschaft

Beschreibung

ValidValue:L

Alle Eingabe-Felder validieren

Rückgaben

Beschreibung

TRUE

alle Eingaben sind korrekt

FALSE

der Fokus wird auf das Eingabe-Feld mit dem inkorrekten Inhalt gesetzt

OnCalcReadyEvent

nach erfolgreicher Kalkulation (entspricht FormVarCalc.OnCalcReady)

Verwendung

  • Erzeugen der TVarCalcPanel-Klasse per CreateObject im Codeblock

  • Zuweisen des Parents auf ein Formular (TFormEx, ...)

  • Zuweisen eines DataSource und eines DataFields oder direktes setzen von FormVarCalc.PL_Memo

    Beispiel

    CODE
    | oVCPanel, oDab010, oForm, oPanel, oEdit1, oEdit2, oBtn, oNavigator, oCheckBox,
      oDM, oDs, oField |
    
    //******************************************************************************
    // Artikel suchen
    //******************************************************************************
    function BtnSearchClick()
      if not DbSeek({Upper(RTrim(oEdit1.Text))}, oDab010) then
         MessageDlg('Artikel wurde nicht gefunden.', mtError)
      endif
    end,
    
    //******************************************************************************
    // Kalkulation ein/ausblenden
    //******************************************************************************
    function CbShowCalcClick()
      oVCPanel.FormVarCalc.ShowCalculation:= not oVCPanel.FormVarCalc.ShowCalculation,
    end,
    
    //******************************************************************************
    // Supervisor-Modus de/aktivieren
    // (funktioniert nur in der Programmier-Umgebung)
    //******************************************************************************
    function CbAdminModeClick()
    | oForm, oAktion |
    oForm:= FindObject(Application, 'F_ProgMain'),
    if not Empty(oForm) then
       oAktion:= FindObject(oForm, 'A_GodMode'),
       if not Empty(oAktion) then
          ActionExecute(oAktion)
       endif,
    endif,
    end,
    
    //******************************************************************************
    // Artikel-Nummer des TVarCalcPanels setzen
    //******************************************************************************
    function DsDab010Change()
      if not Empty(oVCPanel) then
         oVCPanel.ArtNo:= oDab010:ArtNr,
      endif,
    end,
    
    //******************************************************************************
    // Ergebnis der Varianten-Eingabe ausgeben
    //******************************************************************************
    function CalcReady()
      Writeln(oVCPanel.FormVarCalc.PL_Memo),
    end,
    
    //******************************************************************************
    // alle Eingaben prüfen
    //******************************************************************************
    function D010BeforePost()
       if not oVCPanel.ValidValue then
          abort(true),
       endif,
    end,
    
    //******************************************************************************
    // Dialog erzeugen
    //******************************************************************************
    oDM:= CreateObject('TBeDBGet'),
    StartSeq
      oDab010:= DbGetTable(oDM, waDAB010),
      StartSeq
        oDab010.CheckUserRights:= false,
        oForm:= CreateObject('TFormEx', '', Application),
        StartSeq
          AssignEvent(oDab010, 'BeforePost', 'D010BeforePost'),
    
          oForm.KeyPreView     := True,
          oForm.Width          := ScreenWidth / 3,
          oForm.Height         := ScreenHeight / 3 * 2,
          oForm.Position       := poScreenCenter,
    
          oPanel               := CreateObject('TPanel', '', oForm, oForm),
          oPanel.Align         := alTop,
          oPanel.Height        := 120,
    
          oEdit1:= CreateObject('TBeEdit', '', oForm, oPanel),
          oEdit1.Left          := 10,
          oEdit1.Top           := 10,
          oEdit1.Text          := 'TEST',
    
          oEdit2:= CreateObject('TBeEdit', '', oForm, oPanel),
          oEdit2.Left          := oEdit1.Left + oEdit1.Width + 10,
          oEdit2.Top           := oEdit1.Top,
          oEdit2.ReadOnly      := True,
    
          oBtn                 := CreateObject('TBeBitBtn', '', oForm, oPanel),
          oBtn.Left            := oEdit2.Left + oEdit2.Width + 10,
          oBtn.Top             := oEdit2.Top - 2,
          oBtn.Caption         := 'Suche',
          startseq,
             oBtn.Images          := FindObject(FindObject(Application, 'DM_ImageList'), 'ImageListMain'),
             oBtn.ImageIndex.IndexNormal := 91,
          onerror,
             writeln('Imagelist nicht geladen: ' + GetErrorText()),
          stopseq,
    
          AssignEvent(oBtn, 'OnClick', 'BtnSearchClick'),
    
          oDS                  := CreateObject('TDataSourceEx', '', oForm),
          oNavigator           := CreateObject('TDBNavigator', '', oForm, oPanel),
          oNavigator.DataSource:= oDS,
          AssignEvent(oDs, 'OnDataChange', 'DSDab010Change'),
          oDS.DataSet          := oDab010,
          oNavigator.Left      := 10,
          oNavigator.Top       := oEdit1.Top + oEdit1.Height + 10,
    
          oEdit2.DataSource    := oDS,
          oEdit2.DataField     := 'ARTNR',
    
          oField:= DbField('SL_MEMO', oDab010),
    
          oCheckBox            := CreateObject('TCheckBox', '', oForm, oPanel),
          oCheckBox.Left       := 10,
          oCheckBox.Top        := oNavigator.Top + oNavigator.Height + 10,
          oCheckBox.Caption    := 'ShowCalculation',
          AssignEvent(oCheckBox, 'OnClick', 'CbShowCalcClick'),
    
          oCheckBox            :=  CreateObject('TCheckBox', '', oForm, oPanel),
          oCheckBox.Left       := 10,
          oCheckBox.Top        := oNavigator.Top + oNavigator.Height + 30,
          oCheckBox.Caption    := 'AdminMode',
          AssignEvent(oCheckBox, 'OnClick', 'CbAdminModeClick'),
    
          // TVarCalcPanel erzeugen
          oVCPanel:= CreateObject('TVarCalcPanel', '', oForm, oForm),
          oVCPanel.DataSource:= oDs,
          oVCPanel.DataField := 'SL_MEMO',
          oVCPanel.Align     := alClient,
          oVCPanel.ArtNo     := 'TEST',
          AssignEvent(oVCPanel, 'OnCalcReady', 'CalcReady'),
    
          ShowModal(oForm),
    
        Always
          DestroyObject(oForm),
        StopSeq,
      Always
        DestroyObject(oDab010),
      Stopseq
    Always
      DestroyObject(oDM),
    StopSeq

Weitere Verknüpfungen

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.