Access SoftPro TextBox

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Access SoftPro TextBox

Post by mlevi »

We'd like to access a TextBox (or perhaps we should use the SoftPro.Select.Controls.FieldBox class) that exists in the SoftPro UI, and bind a an event handler (ValueChanged) to it.

The particular field that we're looking at is Order.Title.TitleInsuranceCalculations.OwnersPolicy.PremiumCalculation.CoverageAmount.

How can that be done from a shell package?

Thanks
mlevi
Posts: 53
Joined: Mon Dec 01, 2014 2:33 pm

Re: Access SoftPro TextBox

Post by mlevi »

I actually found a way to do this this based on the post by John Morris at viewtopic.php?f=6&t=633&p=2691&hilit=task.

First we cast the premium calculation field to an INotifyProertChanged object and add a property changed listener.

Code: Select all

dynamic o = activeOrder;
dynamic title = o.Title;
dynamic calcs = title.TitleInsuranceCalculations;
dynamic ownersPolicy = calcs[0].OwnersPolicy;

if (ownersPolicy == null) { return; }

dynamic premiumCalculation = ownersPolicy.PremiumCalculation;
decimal coverageAmount = (decimal)premiumCalculation.CoverageAmount;

INotifyPropertyChanged premiumCalculationListener = (INotifyPropertyChanged)premiumCalculation;
premiumCalculationListener.PropertyChanged += new PropertyChangedEventHandler(premiumCalculationListener_PropertyChanged);
Then the handler checks for the field that was changed.

Code: Select all

void premiumCalculationListener_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
       if (e.PropertyName != "CoverageAmount")
       // do something
}
I was just wondering if there was a cleaner way to listen for changes to the CoverageAmount field itself?

Thanks
Post Reply