📘
TimeLine E3
  • TimeLine E3 Documentation
  • Framework
    • Introduction
    • DataSet Definition
    • Window Handling Object
      • Input/Output arguments
      • Open
      • BindDataControls
      • Item Changes
      • Item Search
      • MenuItemClicked
      • Print
      • ModuleOpened (BlueArrow)
      • BlueArrowArguments
      • New Row
      • Delete Row
      • Save
      • Transactions
      • Locking [deprecated]
      • Locking (new)
      • Resizing a response window
      • ParaPanel
      • Adding DMS Tab to a Module
    • BusinessObject
    • Controls
      • BindingFormat
      • LookupGrid and SearchDef
      • ComboBox
      • RadioButton
      • Multiline Textbox
      • xTextBoxSearch
      • xFileBrowse [v16+]
      • DxDispoColumn
      • DxProgressColumn
      • DxTemplateColumn
      • Change control caption programmatically
      • TabControl
      • Navigation
      • Enable controls programmatically
      • Enable a MenuItem programmatically
      • Filter search values
      • Jumping to another module
      • Messages, Notifications, Log, Exceptions, Translation
      • LoggerSink [deprecated]
      • Log
      • OpenFile, FolderBrowsing and SaveFile
      • Execute Actions while displaying an Hourglass
      • Using Progress
      • Async methods with progress bar
      • Wizard
      • Customizing controls using xBehaviors
      • TLProperty.AllowInReadOnly [v16+]
    • DataSet Operations
    • Business-related functionality
      • Getting the next primary key
      • Hybrids
      • Enums
      • Get Current User
    • SQL
    • SQL (using named parameters)
    • Advanced SQL
    • Expression Binding
    • Server-side logic & customization [v16+]
      • Service Hoster
      • Starting / stopping hosted services
      • Changes to scheduled jobs!
      • Business Object Proxies
      • Business Object API
    • Colors in Expression Bindings [v15+]
    • Theming
      • Icons
  • TimeLine Developer (TLD)
    • Debugging in TLD
    • Targets
    • Custom Project Rework [v16+]
  • TimeLine-specific LL functions
  • Stunnel proxy
    • Pre-requisites
    • 1. Initial setup
    • 2. Generate the server/web certificates
    • 3.a. Generating client certificates using the CSR flow
    • 3.b. Generate client certificates from the server console
    • 4. Setting up the E3 client connection
    • 5. Setting up the browser certificates
  • Configuration
    • Configuring the WCF timeout
  • Troubleshooting the E3 Bridge
  • [Deprecated]
    • TimeLine WEB - deprecated in v16+
      • Prerequisites for running the WASM modules on the server
      • Prerequisites for developing WASM modules with TLD
      • Creating a small web module with TLD
      • Terminal Configuration
    • Customization Examples - deprecated in v16+
    • Codestore [deprecated]
    • Configuring the scheduled jobs timeout - deprecated in v16+
Powered by GitBook
On this page
  • ItemChanging
  • ItemChanged
  1. Framework
  2. Window Handling Object

Item Changes

ItemChanging

Manipulate the behavior of the control before the change has taken place. This method can be found in wndProjektPainter (Shortcut: PP)

ItemChanging can return different values:

  • ItemChangingResult.Continue: validates the changing and continues

  • ItemChangingResult.Reject: does not reject the value, keeps the wrong one and does not continue until a valid value is given

  • ItemChangingResult.RejectAndContinue: reject the changes and continues; keeps the previous value of tha variable;

Best practice: use RejectAndContinue.

public override ItemChangingResult ItemChanging(UIElement container, FrameworkElement element, object selectedItem, object newValue, object oldValue)
{
    if (element == tbTerminJahr)
    {
        var newJahr = newValue.ToInt(0);
        if (newJahr < 1900 || newJahr > 2100)
        {
            LoggerSink.PushMessage(this, "Ungültiges Jahr", Severity.Warning);
            return ItemChangingResult.Reject;
        }
    }
    else if (element == tbTerminKW)
    {
        var newKw = newValue.ToInt(0);
        if (newKw < 1 || newKw > 54)
        {
            LoggerSink.PushMessage(this, "Ungültige KW", Severity.Warning);
            return ItemChangingResult.Reject;
        }
    }

    return base.ItemChanging(container, element, selectedItem, newValue, oldValue);
}

ItemChanged

Behavior after changing value of an control.

Since v16 ItemChanged took over the functionality of ItemSearched.

Best-practice: Group your code by selecting the container (DataPanel, DataGrid), followed by the control from the container (TextBox, DataGrid Column).

public override void ItemChanged(UIElement container, FrameworkElement element, object selectedItem, object newValue, object oldValue)
{
    base.ItemChanged(container, element, selectedItem, newValue, oldValue);
        
    if (container == dpKopf)         //DataPanel
    {
        if (element == tbsBetriebsauftrag)           //TextBoxSearch
        {
            var babTyp = tbsBetriebsauftrag.ResultRow["typ"].ToInt(0);
            var babNr = tbsBetriebsauftrag.ResultRow["nr"].ToInt(0);

            if (babTyp > 0 && babNr > 0)
            {
                //Clearview, Retrieve and Set Focus
                NewRueckmeldung(babTyp, babNr);
            }
        }
        else if (element == tbsMitarbeiter)
        {
            var mitarbId = newValue.ToStringNN();
            if (!mitarbId.IsNullOrEmpty())
            {
                ChangeMitarbeiter(mitarbId);
            }
        }
    }
    else if (container == dgZeit)             //DataGrid
    {
        if (element.In(dgtbMenge, dgtbAusschuss))            //DataGrid Column
        {
            RefreshMenge();
        }
        else if (element == dgtbIstzeit)
        {
            RefreshRueckmRes();
            RefreshEffektivZeit();
        }
    }
}

Example where in ItemChanged event we can access the searched row/rows via searchControl.ResultRow/ExtraRows:

The full implementation of this example can be found in PKP.

public override void ItemChanged(UIElement container, FrameworkElement element, object selectedItem, object newValue, object oldValue)
{
    base.ItemChanged(container, element, selectedItem, newValue, oldValue);
 
    //...
    
    else if (element == tbsAfoArbgkatNr)
    {
	RetrieveAFOArbgkatMulti((xTextBoxSearch)element);
    }
    else if (element == tbsAfoArbgkatDG)
    {
	xTextBoxSearch tbsArbgkat = ((DxTextBoxSearchColumn)element).ActiveTextBoxSearch;
	RetrieveAFOArbgkatMulti(tbsArbgkat);
    }
}

public virtual void RetrieveAFOArbgkatMulti(xTextBoxSearch searchControl)
{
    if (searchControl == null) return;
    if (dxgarbpl_afo.SelectedRow == null) return;
    dsProdKontrolPlan.arbpl_afoRow selectedRow = dxgarbpl_afo.SelectedRow;

    BusObj.RetrieveAFOArbgkatMulti(selectedRow, searchControl.ResultRow, searchControl.ExtraRows);

    dpAplAfo.SetFocus(tbAfoBez1.Name);
    this.RefreshMdePanel();
}
PreviousBindDataControlsNextItem Search

Last updated 2 years ago