Share your code snippets, screen shots etc. here
|+31(0)651 200 522 |
In my migration of my VO GUI application I have lost a lot of time because of some TabControl issues.
This could be important for everyone porting VO GUI applications with subclassed TabControls to X#.
The source of all problems is the fact that sometimes in the VO 2.8 development the parameters of 3 strong typed methods were changed from int to dword:
Earlier versions of the VO GUI SDK classes have these parameters typed as int, and the same is true for the Vulcan version.
My subclass of the TabControl, the DynamicTabControl, had overwritten these methods, and that has caused several problems and errors:
P.S. fixing all the warnings the X# compiler gave, I found and fixed several errors in my framework library, some of them there for at least 10 or 15 years.
Hi Wolfgang, all:
Just to explain the situation more to everybody, the code (simplified) in VO was:
CLASS TabControl // in the SDK dll METHOD __FocusPage(nPage AS DWORD) AS VOID METHOD SomeOtherCode() SELF:__FocusPage(1) // this will call __FocusPage() in the child class CLASS MyTabControl INHERIT TabControl // in user code METHOD __FocusPage(nPage AS DWORD) AS VOID
Here the method in the child class overrides the one from the parent class, so when the parent code calls this method, it will be your implementation that will be called.
The problem is that in previous VO builds, the nPage param was defined AS INT instead of DWORD, and this is what the SDK dlls that come with vulcan have, too, so after porting the app, the code ended up as:
CLASS TabControl // in the SDK dll METHOD __FocusPage(nPage AS INT) AS VOID METHOD SomeOtherCode() SELF:__FocusPage(1) // this will call __FocusPage() in the this class, instead of the child class CLASS MyTabControl INHERIT TabControl // in user code METHOD __FocusPage(nPage AS DWORD) AS VOID
here the methods have different param types, so are considered different by the CLR, so the method in the subclass does not override the parent one. The solution is very easy actually, to simply change the param type in the subclassed method to use also an INT, same as the parent method does. Only problem with this solution is that you couldn't have the exact same code working in both VO and X#, so the even better solution is what you did, to update the code in the SDK that you use in X# and change the parameter type there.
XSharp Development Team
Last edit: by Chris. Reason: typos