Show/Hide Toolbars


This example converts the VOPAD AEF file from the C:\cavo28SP3\Samples\Controls\Richedit folder.

After converting it with the same options as the 1st example we will have a folder structure like






VS Solution file


XIDE project file


The project folder contains the files




Module source code


Image resource for VS


Module source code


Image resource for XIDE


Manifest resource for VS


Module source code


Manifest resource for XIDE

PadHelp About.HelpAbout.rc

Help about resource for VS

PadHelp About.HELPABOUT.xsfrm

Help about form Binary for VS

PadHelp About.POWVOBMP.rc

Splash resource for VS

PadHelp About.prg

Module source code

PadHelp About.rc

Help resources for XIDE


Menu resource for VS


Menu binary for VS


Accelerator resource for VS


Module source code


Resources for XIDE


App Icon resource for VS


Module source code


App Icon resource for XIDE


Module source code


Form resource for VS


Form binary for VS


Module source code


Form resource for XIDE


XIDE Application


VS Project

Open the project in VS and compile. You will see the following errors / warnings


PadWin.prg(473,1): warning XS1030: #warning: 'The following method did not include a CLASS declaration'

PadWin.prg(480,1): warning XS1030: #warning: 'The following method did not include a CLASS declaration'

PadHelp About.prg(78,3): error XS9046: Cannot assign to 'font' because it is a 'method'

PadHelp About.prg(81,8): error XS0119: 'TextControl.Font(params __Usual[])' is a method, which is not valid in the given context

PadHelp About.prg(88,3): error XS9046: Cannot assign to 'font' because it is a 'method'

PadHelp About.prg(91,8): error XS0119: 'TextControl.Font(params __Usual[])' is a method, which is not valid in the given context

PadWin.prg(166,19): error XS1061: 'RichEdit' does not contain a definition for 'RTFChangeFont' and no extension method 'RTFChangeFont' accepting a first argument of type 'RichEdit' could be found (are you missing a using directive or an assembly reference?)


Let's examine this by double clickig on the errors / warnings:

First the warnings. These are generated by a #warning preprocessor statement inserted by XPorter because it found problems in your code:

There was an ACCESS FilterIndex CLASS SaveAsDialog in the source. This adds an access to a class in the GUI Classes. This is not allowed in .Net.
The XPorter has created a special subclass of SaveAsDialog to hold this extra property.
Fortunately this ACCESS is no longer needed because it has been added to the GUI Classes already.
So we can completely de        lete that code.

There was a method RTFChangeFont CLASS RichEdit. The same problem as the SaveAsDialog:FilterIndex. In this case the method is necessary. It has been moved to a subclass of RichEdit already. However since the original code still points to the RichEdit class there could be a runtime problem because this method is not part of the richedit class.
There are 2 possible solutions here:

1.Change the method to an extension method

2.Change the code that uses the RichEdit class to use the changed class

Option 1 is the best here since we are not using any private or protected properties of the RichEdit class here. To achieve that change the code from

  CLASS RichEdit_external_class INHERIT RichEdit
  METHOD RTFChangeFont()


  STATIC CLASS RichEditExtensions
  STATIC METHOD RTFChangeFont( SELF oEdit as RichEdit) AS VOID
    LOCAL oFontDlg AS StandardFontDialog
     oFontDlg := StandardFontDialog{oEdit:Owner}
     oFontDlg:FontColor := oEdit:TextColor
     oFontDlg:Font      := oEdit:ControlFont
     oEdit:TextColor := oFontDlg:FontColor
     oEdit:ControlFont      := oFontDlg:Font


The Extension Method works great to enhance existing classes, but has one disadvantage: The Vulcan Runtime will not pick up these extension methods for late bound code.That is not a problem in this example but may be a problem elsewhere.


Now we have added an extension method that can be used like a normal method.
This change also solves the error in PadWin.prg

Then look at the other problems: they all have to do with a Font property in the TextControl class. Unfortunately the VO class libraries have both a Font() method and a Font() Access/Assign for the TextControl class. Having a method and a property with the same name is not allowed in .Net.

When the VO Gui classes were ported to Vulcan the decision has been made to rename the Font property to Controlfont. So we need to make that change. Simply double click on the errors and change




(4 times)

After that the code should compile and run. Clicking the Font button on the toolbar should show the font dialog (from the RTFChangeFont extension method)

Some of the changes that were made to the code (omitting the ones that were also in example 1):

Manifest.prg is empty but included because it had a dependent resource.



You will find the "code before" and "code after" in the XSharp Examples folder