IsMirrored property - what is this?

  • Thread starter Thread starter dgk
  • Start date Start date
D

dgk

I'm searching for a way to determine if control values have changed.
For some it's easy, such as TextBox.Modified. But looking at the
radiobutton I come across IsMirrored. Curious, I look to the help. Not
very helpful. So I look to the newsgroup. Not mentioned. So now I ask.
What does the IsMirrored property tell me?
 
dgk,
Using the Index in Help for IsMirrored, leads you to:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.ismirrored.aspx

Which isn't that helpful, however searching Google for "mirrored controls",
leads you to:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.ismirrored.aspx

Which I find significantly more helpful.

I would say in short "IsMirrored" tells you if the Control is mirrored (as
if you placed it on the edge of a mirror) Right to Left as opposed to the
normal Left to Right.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| I'm searching for a way to determine if control values have changed.
| For some it's easy, such as TextBox.Modified. But looking at the
| radiobutton I come across IsMirrored. Curious, I look to the help. Not
| very helpful. So I look to the newsgroup. Not mentioned. So now I ask.
| What does the IsMirrored property tell me?
 
Doh!

This is the link I meant:

http://www.microsoft.com/middleeast/msdn/mirror.aspx

(which oddly enough was the second link on the Google search page).

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Jay,
|
|
| >
| >Which isn't that helpful, however searching Google for "mirrored
controls",
| >leads you to:
| >
|
| >
| >Which I find significantly more helpful.
|
|
| The second link looks a lot like the first one ;-)
|
|
| Mattias
 
Dgk,
I was answering the "What does the IsMirrored property tell me?" question.

It appears that your "I'm searching for a way to determine if control values
have changed." question remains unanswered.

Are you asking for any property in general, or a specific property, such as
Text?

I normally handle the TextBox.TextChanged event to determine when the Text
property changed. There are similarly named events for their respective
properties. SizeChanged event for the Size property, TabIndexChanged event
for the TabIndex property and so on. A lot of the properties/event pairs are
actually inherited from Control.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| On Tue, 22 Nov 2005 09:49:50 -0600, "Jay B. Harlow [MVP - Outlook]"
|
| >Doh!
| >
| >This is the link I meant:
| >
| >http://www.microsoft.com/middleeast/msdn/mirror.aspx
| >
| >(which oddly enough was the second link on the Google search page).
|
| Oh, very good stuff. Not really applicable to what I was looking for
| in the first place, but fun for a demo.
 
Dgk,
I was answering the "What does the IsMirrored property tell me?" question.

It appears that your "I'm searching for a way to determine if control values
have changed." question remains unanswered.

Are you asking for any property in general, or a specific property, such as
Text?

I normally handle the TextBox.TextChanged event to determine when the Text
property changed. There are similarly named events for their respective
properties. SizeChanged event for the Size property, TabIndexChanged event
for the TabIndex property and so on. A lot of the properties/event pairs are
actually inherited from Control.


Essentially I'm trying to show a "Are you sure you want to discard
your changes" type dialog if someone hits the cancel button after
editing some data. I looked back in the newsgroup history and found a
few good ideas, such as adding handlers to radio buttons so that as
changes occur they set a boolean flag. I'm also recursively running
through the form and containers on the form looking for controls that
will tell me that they were edited.

I'm not doing overkill here. If someone changes a value and then
changes it back, that is still going to set the flag that something
changed. Sort of sloppy I know but I'm under some time pressure here.
Ha, who isn't?

All these values are coming out of an object and going back into that
object, so I suppose that I can do a copy of the object before editing
and then load everything into another object and compare. I'm pretty
sure that comparing the objects will just tell me whether the
variables are pointing to the same object.

I need to understand deep copy and shallow copy a bit better. Most of
the object is pretty straight forward but there are a few collections
in there. Actually they are generic lists. Do you know if a generic
list is duplicated by a shallow copy or do I do a deep copy to get
separate instances?

Very odd. I just tried it on my object and I don't seem to have Copy,
Clone, or anything like that. Oh, ok. I need to use memberwiseclone or
something like that but it's protected. Rats. So I guess I have to
implement my own code for this?

Ah. Well, I look forward to any hints. So much to learn, so little
time.
 
dgk,
| All these values are coming out of an object and going back into that
| object,
Oh! in the case where you have an "object" I would ask the object if any of
its values changed.

In my Property Set methods on my object I call a protected "SetDirty" method
that sets a boolean flag that indicates if the object is dirty. My "object"
then has a public readonly IsDirty property that the UI can use to decide if
its dirty or not. When an object is loaded or saved, the boolean flag is
cleared to indicate that the object itself is not dirty. Generally SetDirty,
IsDirty, and the boolean flag are part of a common base class.

| Essentially I'm trying to show a "Are you sure you want to discard
| your changes" type dialog if someone hits the cancel button after
....
| So I guess I have to
| implement my own code for this?
I would consider implementing a "Clone" method that returns a "copy" of the
current object, this method would use MemberwiseClone if a shallow copy was
acceptable, otherwise it would do a deep copy. Be careful on deep copies &
object hierarchies.

Alternatively I would consider having 2 fields for each property of my
"object", a current value & an original value. The "object" would have a
"Revert" method that would restore the current values to the "original"
values. When I load the object I would set both fields to the same value.


--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| On Mon, 28 Nov 2005 08:56:34 -0600, "Jay B. Harlow [MVP - Outlook]"
|
| >Dgk,
| >I was answering the "What does the IsMirrored property tell me?"
question.
| >
| >It appears that your "I'm searching for a way to determine if control
values
| >have changed." question remains unanswered.
| >
| >Are you asking for any property in general, or a specific property, such
as
| >Text?
| >
| >I normally handle the TextBox.TextChanged event to determine when the
Text
| >property changed. There are similarly named events for their respective
| >properties. SizeChanged event for the Size property, TabIndexChanged
event
| >for the TabIndex property and so on. A lot of the properties/event pairs
are
| >actually inherited from Control.
|
|
| Essentially I'm trying to show a "Are you sure you want to discard
| your changes" type dialog if someone hits the cancel button after
| editing some data. I looked back in the newsgroup history and found a
| few good ideas, such as adding handlers to radio buttons so that as
| changes occur they set a boolean flag. I'm also recursively running
| through the form and containers on the form looking for controls that
| will tell me that they were edited.
|
| I'm not doing overkill here. If someone changes a value and then
| changes it back, that is still going to set the flag that something
| changed. Sort of sloppy I know but I'm under some time pressure here.
| Ha, who isn't?
|
| All these values are coming out of an object and going back into that
| object, so I suppose that I can do a copy of the object before editing
| and then load everything into another object and compare. I'm pretty
| sure that comparing the objects will just tell me whether the
| variables are pointing to the same object.
|
| I need to understand deep copy and shallow copy a bit better. Most of
| the object is pretty straight forward but there are a few collections
| in there. Actually they are generic lists. Do you know if a generic
| list is duplicated by a shallow copy or do I do a deep copy to get
| separate instances?
|
| Very odd. I just tried it on my object and I don't seem to have Copy,
| Clone, or anything like that. Oh, ok. I need to use memberwiseclone or
| something like that but it's protected. Rats. So I guess I have to
| implement my own code for this?
|
| Ah. Well, I look forward to any hints. So much to learn, so little
| time.
 
dgk,
| All these values are coming out of an object and going back into that
| object,
Oh! in the case where you have an "object" I would ask the object if any of
its values changed.

In my Property Set methods on my object I call a protected "SetDirty" method
that sets a boolean flag that indicates if the object is dirty. My "object"
then has a public readonly IsDirty property that the UI can use to decide if
its dirty or not. When an object is loaded or saved, the boolean flag is
cleared to indicate that the object itself is not dirty. Generally SetDirty,
IsDirty, and the boolean flag are part of a common base class.

| Essentially I'm trying to show a "Are you sure you want to discard
| your changes" type dialog if someone hits the cancel button after
...
| So I guess I have to
| implement my own code for this?
I would consider implementing a "Clone" method that returns a "copy" of the
current object, this method would use MemberwiseClone if a shallow copy was
acceptable, otherwise it would do a deep copy. Be careful on deep copies &
object hierarchies.

Alternatively I would consider having 2 fields for each property of my
"object", a current value & an original value. The "object" would have a
"Revert" method that would restore the current values to the "original"
values. When I load the object I would set both fields to the same value.

But I'm planning on updating all the properties, whether they've
changed or not, which means that prior to calling SetDirty from each
property I should check to see if the Set is actually changing the
private value. Pain. I have a LOT of properties - hmm, this should
have been part of the Property snippet. Now I have to learn to edit
snippets.

Actually I already implemented something like this which I borrowed
from an example that I saw. It actually uses a DataRowState object to
track the changes which is neat because I can also store the fact that
it is new if that is the case.

Ok, here's another idea. Someone MUST have done this already. I write
a public method in the object that accepts another object instance as
a parameter and then uses reflection to determine all of its
properties and compares the output of the Get from each one to
determine if the objects are identical. Did I just duplicate some
functionality that already exists? I hate when I do that.
 
Dgk,
Ok, here's another idea. Someone MUST have done this already. I write
a public method in the object that accepts another object instance as
a parameter and then uses reflection to determine all of its
properties and compares the output of the Get from each one to
determine if the objects are identical. Did I just duplicate some
functionality that already exists? I hate when I do that.
Implementing Equals or Compare via reflection is easy enough I don't know if
I would be concerned with duplicating other peoples work, as its a good
learning experience. Whether or not I used it would depend on performance &
behavior ramifications. For equals behavior shouldn't matter, however for
comparing behavior could be affected as you cannot control the sequence of
the comparisons (there is no guarantee on the order that the properties are
returned).

The method created however would/could be the basis for IEquatable(Of T) &
IComparable(Of T) in VS 2005 (Overrides System.Equals & IComparable in VS
2002 & 2003).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top