471,089 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

Can I ignore xxxChanged events while data binding?

Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #1
2 1236
Hi Larry

you could use removehandler and addhandler on the controls, remove all the
handlers before databinding and then add them again afterwards

Hope this helps

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Larry Lard" <la*******@hotmail.com> schreef in bericht
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #2
Not sure but you could also try SuspendBinding. REsumeBindig...

--

"Larry Lard" <la*******@hotmail.com> a écrit dans le message de
news:11**********************@g44g2000cwa.googlegr oups.com...
Here's the scenario:

Show the user a list of Things. User picks one, and the Thing edit
frame is populated with the details of the Thing they picked. This
frame has Save / Discard buttons that are initially disabled. When the
user makes a change to any of the details of the Thing, those buttons
become enabled (because there are now changed to Save or Discard).

So I have a ThingDirty property, and all the xxxChanged events of the
Thing detail controls set ThingDirty = True, and in the Property Set of
ThingDirty, I set the Enabled of the Save / Discard buttons to the new
value of ThingDirty. Furthermore, I set ThingDirty to False just after
populating the detail area.

Almost perfect. Except - when the user picks a thing, the detail area
is populated through the magic of data binding - and this triggers all
those xxxChanged events. So every time a Thing is selected, the Save /
Discard buttons briefly flash enabled (as the data binding happens)
before being set disabled.

My workaround is a horrible form-level variable called
dataBindingInProgress, which I manually set/reset around the data read
operation, and which when set tells the Property Set *not* to touch the
Enabled of the buttons. Is there a more'built-in' way? Like a property
on the BindingSource (or somewhere) that means 'binding in progress'?
So the controls can know they are being *initialised* and not *changed*
?

--
Larry Lard
Replies to group please

Feb 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Saix News | last post: by
reply views Thread by popsovy | last post: by
2 posts views Thread by Andrew Robinson | last post: by
19 posts views Thread by Simon Verona | last post: by
2 posts views Thread by David Veeneman | last post: by
1 post views Thread by Peter | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.