How to declare object as Vulcan.Net

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

How to declare object as Vulcan.Net

Post 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.
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

How to declare object as Vulcan.Net

Post 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
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
Phil Hepburn
Posts: 743
Joined: Sun Sep 11, 2016 2:16 pm

How to declare object as Vulcan.Net

Post 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.
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

How to declare object as Vulcan.Net

Post 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
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply