|
Mr. Cully wrote:
any ideas on how to solve this?
Some glasses perhaps....
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I'm sitting staring at this trying to figure out where my reply went, then I see I'm in the C# forum.... :P
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
The STL can solve this too CG.
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Nick Parker wrote:
The STL can solve this too CG.
Well, now that goes without saying, right ?
I recently discovered that Array has static functions for sorting and so on. Nowhere near what the STL has, but at least it's something.....
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
I recently discovered that Array has static functions for sorting and so on. Nowhere near what the STL has, but at least it's something.....
I find it interesting to use Reflector[^] and just go through the namespaces and pick a class to see everything. The Marshal class in System.Runtime.InteropServices is my current read, when I have free time that is.
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Nick Parker wrote:
I find it interesting to use Reflector[^] and just go through the namespaces and pick a class to see everything
Whew, I'm not the only one then...
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
David Stone wrote:
Whew, I'm not the only one then...
Just don't try to use that as a pick-up line, k David?
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Nick Parker wrote:
Just don't try to use that as a pick-up line, k David?
Stupid geek one-liners:
- Hey baby...wanna go back to my PC and reflect over your
System.Reflection.Assembly ?
- If you're having trouble with that, I could give you a few
IntPtr s...
- You know, I really feel like we're communicating on the same
System.Runtime.Remoting.Channels.IChannel here...
- Mmmm...I'd love to get a
Peek() at that System.Collections.Stack ...
What's sad is that I can think of a lot more...and they get dirtier...
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
David Stone wrote:
Whew, I'm not the only one then...
Nope - and I use it too. It's such a help to be able to see exactly what will happen when you call a certain method or property.
|
|
|
|
|
I want to make a function unaccessable in a child class (that's public in the parent class)
The parent class has:
public virtual void ShowPopup(System.Drawing.Point p)
I tried doing this in the child class:
private override void ShowPopup(System.Drawing.Point p)
The compiler compains that I can't make a virtual function private
Any ideas how I could hide this function?
Thanks,
Elena
Elena
|
|
|
|
|
The compiler is right because private means that only the class that has the method/property/field can use it. No other class is permitted access including any class derived from it. And virtual tells the compiler to expect derived classes to override it. Therefore making a method private and virtual would be utterly pointless.
Hiding the method kind of goes against the grain of Object Orientation. I remember years ago my OO lecturer at University going on about that. When you create derived classes you are creating specialisations of the base. You should never be taking anything away from the base, just adding new methods and specialising existing ones.
I would suggest that you re-examine your class design and work out if there is a way to better design the classes so that you are not having to take away the functionality in the base.
Alternatively you could explain a bit about your design and maybe some people here can help you re-work it.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
Thank you for your replies.
The reason why I want to hide the parent class is because I need more data for the child.
By the way the parents class is built in, I can't change it: DevExpress.XtraBars.PopupMenu
I want the user to call the following function that is implemented by the child
public void ShowPopup(System.Drawing.Point p, File selectedFile, Folder selectedFolder, Folder destinationFolder)
instead of the original
public void ShowPopup(System.Drawing.Point p)
I could have two separate calls: SetFileData(selectedFile, selectedFolder, destinationFolder) and then ShowPopup(p), but there will be big bad problems if the user forgets to make the first call.
Elena
|
|
|
|
|
I assume by "user" in this case you mean another "developer". To avoid confustion, I'll use the term "developer" to mean a person that writes code, and "user" to mean a person that uses software applications.
Okay, so you have a third party component that exposes a method called ShowPopup(), you want to derive a class from it and extend the functionality by implementing your own ShowPopup with extra parameters. In the new derived class the base.ShowPopup() will work correctly so long as the developer has called SetFileDate(). Right?
My advice is to not mollycoddle other developers, defend against users doing weird things but not developers. Document that there is an extended version of ShowPopup() with the extra parameters which is to be used in preference for this class. Also document that if the original ShowPopup is used that the SetFileData() must be called first for this class. Anything else is wrong and will cause an exception to be thrown (remember that is what exceptions are for).
Here's an example of something designed in a similar way to what I've described: What happens if you have an array with 5 elements and you try and get the 10th element? An exception is thrown. Why? Because that was a dumb thing to do.
If it helps, you should override the ShowPopup() [You mentioned it was virtual already] and check for the prensence of the file data and throw the relevant exception if it doesn't exist. (If you don't have a relevant exception, create a new exception class)
Begin Rambling Nostalgia: I remember back in the days where I did C++ development the documentation was full of remarks like "The first parameter takes an integer between 1 and 12, for any other supplied value the results are undefined". In other words, "Garbage In, Garbage Out". In reality the "undefined" results could mean anything from invalid calculations to the whole application crashing. At least now there are exceptions so that invalid/missing inputs or expected preconditions can be thrown out and dealt with properly.
I hope this helps.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
You can't make a public function in a parent class private in a child child class. if you could, it would break polymorphism since the inherited class would not support the parent's "interface" or contract. What you can do is override ShowPopup so that is does nothing.
|
|
|
|
|
Mailing Lists wrote:
What you can do is override ShowPopup so that is does nothing.
You could do. But that sounds really messy and horrible because it could be that some time later a developer is doing something and expecting a pop up and then spending ages trying to work out why a popup wasn't happening. Then I'd get really .
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
I would override the method and throw an NotSupportedException . And document that the method is not supported. This keeps the developers out of confusion. Maybe like this:
throw new NotSupportedException("This method is not supported by this class.
Use the overload ShowPopup(Point, File, Folder, Folder) instead.")
|
|
|
|
|
elena12345 wrote:
Any ideas how I could hide this function?
Encapsulation
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
I'm sorry if my question sounds silly:
Can i bind a property of a control to another property of
another control?
I´m trying to bind the Text property of a Label control to
a custom property of a custom control (derived from Control). What should I do?
My goal is to write something like:
Label.DataBindings.Add("Text",CustControl.Property, "");
Thanks.
|
|
|
|
|
Yes you can, and the code you wrote should work. This is managed by the PropertyManager , as opposed to the CurrencyManager that's used for data-type data-binding. See the documentation for the PropertyManager class for more details.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I think you mite need to apply the DataBindableAttribute to the property.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
When coding in the editor, I get intellisense hints with the description I made for my objects, functions and parameters. This I get automatically, the only think you must do is to use the documentation tags.
Unfortunatelly, this works only within a single project. When using the documented component in the client application, I do get only class/method with names and function signatures without any documentation. The assembly produced by VS.NET simply lacks the documentation I prepared.
I tried to compile the project using /doc directive hoping that the file gets compiled into the assembly somehow (although there is no explicit mention about this functionality in MSDN documentation). Actually, I'm lacking any information how the C# documentation offers and how compile the documentation into the assembly. Do you know some resource?
What's the heck? Perhaps I should search somewhere else than in VS.NET?
Thanks for help
Vasek
VB6, C#, MS DNA, MS.NET
Software Developer
|
|
|
|
|
You must use the documentation syntax and either use the /doc:AssemblyName.xml flag on the command-line compiler, or set the same filename in the Documentation setting in the project's configuration dialog (right-click on the project and select Properties).
These XML files should be in the same directories as the assemblies. Note, they are NOT added to the assembly. If you want to generate HTML Help or Help 2 help files out of them, see the NDoc project.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Jeez Heath, do you ever sleep? Don't you have work to do somewhere? I thought I could beat you to this one...but you out-posted me by one minute.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Heath Stewart wrote:
/doc:AssemblyName.xml
Thanks for reply. This I did but still not have the documentation in the Intellisense. How do I tell to IDE that it should use that file?
Vasek
VB6, C#, MS DNA, MS.NET
Software Developer
|
|
|
|
|
Remember that those XML files must be in the same directory as the assemblies you're referencing. This is how VS.NET and other IDEs (or some tools out there) find the necessary documentation. So, if you move your assemblies out of the target output directories, make sure you take the XML documentation files with them.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|