xsharp.eu • How to declare object as Vulcan.Net
Page 1 of 1

How to declare object as Vulcan.Net

Posted: Fri Mar 16, 2018 8:01 pm
by boonnam
I'm working on an XSharp project that we converted from VO 2.7. Here is a partial example of a constructor of one of the class in XSharp...

CLASS _QLMerge INHERIT DATAWINDOW

PROTECT oCCRB_MergeDocument AS RADIOBUTTON

//{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)

CONSTRUCTOR(oWindow,iCtlID,oServer,uExtra)

self:PreInit(oWindow,iCtlID,oServer,uExtra)

SUPER(oWindow,ResourceID{"_QLMerge",_GetInst()},iCtlID)

oCCRB_MergeDocument := RadioButton{SELF,ResourceID{_QLMERGE_RB_MERGEDOCUMENT,_GetInst()}}
oCCRB_MergeDocument:HyperLabel := HyperLabel{#RB_MergeDocument,"Create a policy merge letter",NULL_STRING,NULL_STRING}

This code compile no problem before I added reference to "System.Windows.Forms" yesterday. After I added "System.Windows.Forms", I get these errors:
'RadioButton' does not contain a constructor that takes 2 arguments

'RadioButton' does not contain a definition for 'HyperLabel' and no extension method 'HyperLabel' accepting a first argument of type 'RadioButton' could be found (are you missing a using directive or an assembly reference?)

'RadioButton' does not contain a definition for 'OwnerAlignment' and no extension method 'OwnerAlignment' accepting a first argument of type 'RadioButton' could be found (are you missing a using directive or an assembly reference?)

How do I declare "oCCRB_MergeDocument" as RadioButton from Vulcan or VO namespace?

Thanks.

How to declare object as Vulcan.Net

Posted: Fri Mar 16, 2018 9:26 pm
by FFF
Boonam,
probably you need the full name. In Xide i point onto Radiobutton, right click and see in the context menu the Class' full name is Vulcan.VO.RadioButton

HTH
Karl

How to declare object as Vulcan.Net

Posted: Fri Mar 16, 2018 10:39 pm
by Phil Hepburn
Karl,

Boonam is right - there are now at least two (more than one) Radio Buttons, in different namespaces - so you need to give a fuller 'name'.

Did you get any messages about any 'conflict' of names ?

Do you need both 'USING' statements a the top of your PRG file ? Can you remove the offending one which is Not 'Forms' ?

HTH,
Phil.

How to declare object as Vulcan.Net

Posted: Fri Mar 16, 2018 10:49 pm
by Chris
Hi Boonam,

Yes, as Karl and Phil said it's because of a naming conflict, there are 2 RadioButton classes, one is System.Windows.Forms.RadioButton and the other is Vulcan.VO.RadioButton. Specifying the full name for them always, will always resolve ambiguity.

Another option is to use in each .prg file a USING statement only for those classes that you intend to use in this prg. For example use USING System.Windows.Forms only in the prg files where you intend to use something from this namespace.

Just note though that when the "Enable Implicit Namespace lookup" (/ins) project option is enabled (it is enabled by default in ported projects), then the compiler always automatically includes an implicit USING Vulcan.VO statement in every .prg, when you are referencing the SDK dlls, so you might want to disable that and handle all USING statements manually.

Those are the possible options, although I suspect in your case in 99% of the prg files, you are only using the VOSDK controls and in only a few files you need something from System.Windows.Forms. If that's the case, easier solution is to keep the "Enable Implicit Namespace lookup" option, do not add USING System.Windows.Forms commands at all and instead fully qualify the types you use from this dll/namespace.

Chris