Porting VO Code

This forum is meant for questions and discussions about the X# language and tools
markus.lorenzi@dvbern.ch
Posts: 107
Joined: Mon May 02, 2016 9:10 am
Location: Schweiz

Porting VO Code

Post by markus.lorenzi@dvbern.ch »

Hi Dev Team

I just tried to convert one of our VO-Programs. I was able to correct the most of the errors.
But These two Things does not compile:

Split Window Class:

SELF:Font := Font{,9,"Arial"}
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand
Fehler XS0144 Cannot create an instance of the abstract class or interface 'Font'


SELF:oDefaultIcon := Icon{ ICONSTANDARD }
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand
Fehler XS0144 Cannot create an instance of the abstract class or interface 'Icon'

Any idea how to solve this?
TIA Markus
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Porting VO Code

Post by Chris »

Hi Markus,

Those are strange errors..have you created your own Icon and Font class in the code? Maybe in VO you had added additional methods to the already existing Font/Icon classes? Or maybe there is something else causing the problem, can you send the full code of this class so we can have a look?

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
markus.lorenzi@dvbern.ch
Posts: 107
Joined: Mon May 02, 2016 9:10 am
Location: Schweiz

Porting VO Code

Post by markus.lorenzi@dvbern.ch »

Hi Chris

thanks for your fast answer. I attached the solution to this post.
I didn't find an own font class in this Project.

HTH and TIA Markus
MyExplorer.zip
(395.87 KiB) Downloaded 33 times
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Porting VO Code

Post by Chris »

Hi Markus,

Thanks for providing the code! The problem is that there's a Font and Icon class defined in the Excel library, which conflicts with the Font and Icon classes in the SDK. There are 2 solutions:

1. Remove the USING Microsoft.Office.Interop.Excel command and supply this namespace when needed, for example change

LOCAL oWorkbooks AS Workbooks

to

LOCAL oWorkbooks AS Microsoft.Office.Interop.Excel.Workbooks

2. Keep the USING Microsoft.Office.Interop.Excel command, but prefix the classes from the SDK with "Vulcan.VO", this is the namespace used by the compiled SDK classes. So for example change

PROTECT oDefaultIcon AS Icon
...
SELF:Font := Font{,9,"Arial"}
...
SELF:oDefaultIcon := Icon{ ICONSTANDARD }

to

PROTECT oDefaultIcon AS Vulcan.VO.Icon
...
SELF:Font := Vulcan.VO.Font{,9,"Arial"}
...
SELF:oDefaultIcon := Vulcan.VO.Icon{ ICONSTANDARD }

Using either way it should compile fine now!

Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Porting VO Code

Post by robert »

Chris,

Maybe one more addition to your comment about prefixing classes with namespaces.
We now also have the ability to define an alias for a namespace. So you can write:

Code: Select all

USING Excel := Microsoft.Office.Interop.Excel
This allows you to simplify the namespace in your code. Instead of

Code: Select all

LOCAL oWorkbooks AS Microsoft.Office.Interop.Excel.Workbooks
you can then write

Code: Select all

LOCAL oWorkbooks AS Excel.Workbooks
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
markus.lorenzi@dvbern.ch
Posts: 107
Joined: Mon May 02, 2016 9:10 am
Location: Schweiz

Porting VO Code

Post by markus.lorenzi@dvbern.ch »

Hi Chris, hi Robert

first of all I have to thank for your really fast Responses!
It's a pleasure to work this way.

With These fixes I can compile the solution without Errors. Unfortunately the app crashes on the instantiation of the TreeView object. I commented out the try/catch in the start.prg to get more Details about the error but have no idea whats the reason for the Crash.

Thanks Markus
MyExplorer.zip
(395.63 KiB) Downloaded 30 times
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Porting VO Code

Post by wriedmann »

Hi Markus,

just a shot in the dark: do you have the cato*.dll files in the application directory? AFAIK the TreeView needs them too.

Wolfgang

P.S. I'm have successfully transported the FTPExplorer to X#, so the ListView/TreeView/SplitWindow work in X#.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Porting VO Code

Post by robert »

Markus,

Was this really an app that ran in VO this way or did you copy and paste some code from different VO apps and combine this in the X# app ?

The Treeview and Listview class need a Point and Dimension argument to work properly.
In your MyTreeView class change:

Code: Select all

SUPER(arg1,arg2)
to

Code: Select all

SUPER(arg1,arg2,Point{}, Dimension{})
and in your clas IMSListView make the following change:

Code: Select all

CONSTRUCTOR(oOwner, nId, oPoint, oDim, kStyle) 
	SUPER(oOwner, nId, oPoint, oDim, kStyle)

Code: Select all

CONSTRUCTOR(oOwner, nId, oPoint, oDim, kStyle) 
   IF IsNil(oPoint)
      oPoint := Point{}
   ENDIF	
   IF IsNil(oDim)
      oDim := Dimension{}
   ENDIF	
SUPER(oOwner, nId, oPoint, oDim, kStyle)
I could not completely test your app because I am missing the resources, and I have the impression that not all the code is there.
The Drive array is missing some array elements I think, and element # 2 in each row is not numeric as it is supposed to be.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Porting VO Code

Post by Chris »

Hi Markus,

In addition to what Wolfgang and Robert said, if the app still doesn't run without errors, can you please send also the VO .aef file so we can try porting it also in our machines?

thanks,
Chris
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
markus.lorenzi@dvbern.ch
Posts: 107
Joined: Mon May 02, 2016 9:10 am
Location: Schweiz

Porting VO Code

Post by markus.lorenzi@dvbern.ch »

Hi Chris

here is the aef which works well in VO 2.8.
The program is just a sample which I want to use in our next VO Usergroup Meeting to demonstrate the way from VO to X#.

Markus
FeserExplorer.zip
(990.91 KiB) Downloaded 30 times
Attn. Robert: The error with the ListView was my fault as I tried different Things and did a copy&paste mistake.
Post Reply