Custom PosSizer
Author: jammau
Creation Date: 4/7/2010 1:09 AM
profile picture

jammau

#1
Hi All,

I'm having some problems implementing a custom PosSizer. I have created a PosSizer that works the way I want it although, as I'm no programmer, I started by hard coding the parameters it requires - and this works perfectly. The next logical step is to make the parameters configurable and this is where the trouble starts. I'm using Visual C# 2008 Express.

I have followed the API documentation and based my PosSizer on the open source Random PosSizer [I have noted the MaxEntriesPerDay code in the API documentation].

When attempting to implement the ICustomSettings interface, I encounter the following problem
QUOTE:
Class xxxxx cannot have multiple base classes


My code:
CODE:
Please log in to see this code.


The sample code provided
CODE:
Please log in to see this code.

CODE:
Please log in to see this code.


I have tried creating a new class library and copy/paste the Random PosSizer code however it meets the same error. I have Googled this error and it appears that this type of action is not valid in C#. So I'm clearly missing something. How do i implement this interface?

Secondly, the Random PosSizer includes the following using statement:
CODE:
Please log in to see this code.


When I try to use this using statement, I'm told that I'm missing a directive or an assembly reference. If I Google this, I do not find any useful information, nor can I find a CtrlLib.dll anywhere. Do I need this using statement?

Were these samples written using C++ or something? Is that what I am missing?

As usual, your help is greatly appreciated!

Thanks

Regards

James
profile picture

Eugene

#2
Hi James,
QUOTE:
Were these samples written using C++ or something? Is that what I am missing?

No, it's pure C#.
QUOTE:
If I Google this, I do not find any useful information, nor can I find a CtrlLib.dll anywhere. Do I need this using statement?

The "CtrlLib" lives inside ControlLibrary.dll (in Wealth-Lab's main folder under Program Files) and its only purpose is to host the "NumEdit" control. You can simply add a reference to ControlLibrary.dll or, if you don't need Fidelity's NumEdit and can live with .NET's default NumericUpDown control, remove the using directive altogether.
QUOTE:
Class xxxxx cannot have multiple base classes

As a side note, C# does not support multiple inheritance (i.e. deriving a class from more than one class), but deriving a class from multiple interfaces is perfectly valid - this is what the demo code does: derives a class from the two interfaces, ICustomSettings and PosSizer. I think you may have this mistake somewhere else in your code. VS2008 should point you to the line where you're probably trying to inherit from 2 classes. If troubleshooting it leads nowhere, zip and attach the project's source code (you may omit the logic in SizePosition) to a new support ticket.
QUOTE:
I'm using Visual C# 2008 Express.

Make sure you've selected ".NET 2.0" as the PosSizer's target framework in project's properties.
profile picture

jammau

#3
Thanks Eugene

I'll have another look at this in the morning.

Much appreciated.

James
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).