SmartViewer - Best Way To Enable Fields During Add
 
Forums / SmartComponent Library - Developer Forum / SmartViewer - Best Way To Enable Fields During Add

SmartViewer - Best Way To Enable Fields During Add

5 posts, 1 answered
  1. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    12 Dec 2018
    Link to this post
    When we are adding a record we want certain fields to be enabled for input otherwise they are disabled. Right now, I am using the BeforeAddRecord event to set a variable and then in AfterFieldsEnabled I will check this variable and then enable these fields if we are adding a record. I reset this variable in AfterSaveChanges as well as AfterCancelUpdate.

    Is this the best way to do this or is there a better way?
  2. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    12 Dec 2018 in reply to Roger Blanchard
    Link to this post
    I guess I could enable / disable in the following;

    METHOD OVERRIDE PROTECTED VOID OnAfterCancelUpdate( INPUT e AS System.EventArgs ):
      
      SUPER:OnAfterCancelUpdate(INPUT e).
      
      THIS-OBJECT:eItem_ItemNum:Enabled = FALSE.
     END METHOD.
     METHOD OVERRIDE PROTECTED VOID OnAfterSaveChanges( INPUT e AS System.EventArgs ):
      
      SUPER:OnAfterSaveChanges(INPUT e).
      
      THIS-OBJECT:eItem_ItemNum:Enabled = FALSE.
     END METHOD.
     METHOD OVERRIDE PROTECTED VOID OnBeforeAddRecord( INPUT e AS System.ComponentModel.CancelEventArgs ):
      
      SUPER:OnBeforeAddRecord(INPUT e).
      
      THIS-OBJECT:eItem_ItemNum:Enabled = TRUE.
     END METHOD.
  3. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    Answered
    12 Dec 2018 in reply to Roger Blanchard
    Link to this post
    Add this at the end of the viewers constructor:

    THIS-OBJECT:SetControlEnabled (eCustomer_CustNum, Consultingwerk.SmartComponents.Enum.ControlEnabledEnum:Add).

    https://help.consultingwerkcloud.com/smartcomponent_library/117_64/Consultingwerk.SmartComponents.Base.SmartViewerControl.html
  4. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    12 Dec 2018 in reply to Mike Fechner
    Link to this post
    GREAT!! THANK YOU...that will be much easier.
  5. Roger Blanchard
    Roger Blanchard avatar
    413 posts
    Registered:
    29 Jun 2018
    12 Dec 2018 in reply to Mike Fechner
    Link to this post
    works great, thanks.
5 posts, 1 answered