Porting VO Forms to Winform or WPF

This forum is meant for questions and discussions about the X# language and tools
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Porting VO Forms to Winform or WPF

Post by Jamal »

There is a product by Paul Piko called Facelift Professional 2 for VO which ported VO datawindows and dialogs to WinForms, WPF in C#, VB.NET and (X#, but not fully since X# was still being developed), however , it has not been maintained for several years and no longer compatible with VS 2019. I contacted Paul and he replied quickly, but indicated other development project took him away from the the xBase world.

I've used the xPorter which is great at converting VO code but VO datawindow and dialog are not true Winforms or WPF forms. I could not even copy/paste the created VO controls on new Winforms controls I guess since they are not compatible. I know I can create the Winforms manually, but the task becomes very tedious.

Therefore, I see this as a big obstacle in migrating VO to Winforms (at least), and the questions will we ever see a similar tool like Facelift integrated in VS or be part of the xPorter?

Jamal
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Porting VO Forms to Winform or WPF

Post by wriedmann »

Hi Jamal,

Robert is planning to add a VO GUI classes compatible WInForms based library:
https://www.xsharp.eu/articles/updated- ... e-schedule
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Porting VO Forms to Winform or WPF

Post by Jamal »

Hi Wolfgang,

That's not exactly what I am talking about. The proposal is to port the VO generated a datawindow or dialog resource entity from from a VO AEF and convert to Winform or WPF.

Please see the samples that Paul Piko provides:

VO resource before:

Code: Select all

RESOURCE WinOrder DIALOGEX  4, 3, 456, 289
STYLE	WS_CHILD
FONT	8, "MS Shell Dlg"
BEGIN
	CONTROL	"Order No:", WINORDER_SC_ORDERNO, "Static", WS_CHILD, 13, 8, 39, 10
	CONTROL	"Order Date:", WINORDER_SC_ORDERDATE, "Static", WS_CHILD, 236, 8, 48, 10
	CONTROL	"Name:", WINORDER_SC_BILLNAME, "Static", WS_CHILD, 13, 38, 30, 10
	CONTROL	"Address 1:", WINORDER_SC_BILLADD1, "Static", WS_CHILD, 13, 50, 43, 10
	CONTROL	"Address 2:", WINORDER_SC_BILLADD2, "Static", WS_CHILD, 13, 62, 39, 10
	CONTROL	"Address 3:", WINORDER_SC_BILLADD3, "Static", WS_CHILD, 13, 75, 45, 9
	CONTROL	"Postal Code:", WINORDER_SC_BILLPOST, "Static", WS_CHILD, 13, 87, 49, 10
	CONTROL	"Phone:", WINORDER_SC_BILLPHONE, "Static", WS_CHILD, 13, 99, 33, 10
	CONTROL	"Name:", WINORDER_SC_DELIVNAME, "Static", WS_CHILD, 236, 38, 38, 10
	CONTROL	"Address 1:", WINORDER_SC_DELIVADD1, "Static", WS_CHILD, 236, 50, 36, 10
	CONTROL	"Address 2:", WINORDER_SC_DELIVADD2, "Static", WS_CHILD, 236, 62, 36, 10
	CONTROL	"Address 3:", WINORDER_SC_DELIVADD3, "Static", WS_CHILD, 236, 75, 36, 9
	CONTROL	"Postal Code:", WINORDER_SC_DELIVPOST, "Static", WS_CHILD, 236, 87, 50, 10
	CONTROL	"Phone:", WINORDER_SC_DELIVPONE, "Static", WS_CHILD, 236, 99, 36, 10
	CONTROL	"Comment:", WINORDER_SC_ORDCOMMENT, "Static", WS_CHILD, 8, 121, 36, 10
	CONTROL	"Shipping:", WINORDER_SC_SHIPPING, "Static", WS_CHILD, 348, 221, 31, 10
	CONTROL	"Tax:", WINORDER_SC_TAX, "Static", WS_CHILD, 348, 235, 36, 9
	CONTROL	"Discount:", WINORDER_SC_DISCOUNT, "Static", WS_CHILD, 348, 249, 32, 10
	CONTROL	"Orderno:", WINORDER_ORDERNO, "Edit", ES_READONLY|ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 8, 54, 11, WS_EX_CLIENTEDGE
	CONTROL	"Orderdate:", WINORDER_ORDERDATE, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 8, 45, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billname:", WINORDER_BILLNAME, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 38, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billadd1:", WINORDER_BILLADD1, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 50, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billadd2:", WINORDER_BILLADD2, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 62, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billadd3:", WINORDER_BILLADD3, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 75, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billpost:", WINORDER_BILLPOST, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 87, 54, 11, WS_EX_CLIENTEDGE
	CONTROL	"Billphone:", WINORDER_BILLPHONE, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 68, 99, 101, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivname:", WINORDER_DELIVNAME, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 38, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivadd1:", WINORDER_DELIVADD1, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 50, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivadd2:", WINORDER_DELIVADD2, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 62, 148, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivadd3:", WINORDER_DELIVADD3, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 75, 55, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivpost:", WINORDER_DELIVPOST, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 87, 55, 11, WS_EX_CLIENTEDGE
	CONTROL	"Delivphone:", WINORDER_DELIVPHONE, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 291, 99, 101, 11, WS_EX_CLIENTEDGE
	CONTROL	"Ordcomment:", WINORDER_ORDCOMMENT, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 44, 121, 404, 11, WS_EX_CLIENTEDGE
	CONTROL	"Shipping:", WINORDER_SHIPPING, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 396, 221, 40, 11, WS_EX_CLIENTEDGE|WS_EX_RIGHT
	CONTROL	"Tax:", WINORDER_TAX, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 396, 235, 40, 11, WS_EX_CLIENTEDGE|WS_EX_RIGHT
	CONTROL	"Discount:", WINORDER_DISCOUNT, "Edit", ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 396, 249, 40, 11, WS_EX_CLIENTEDGE|WS_EX_RIGHT
	CONTROL	"", WINORDER_WINORDER_DETAIL, "static", WS_CHILD|WS_BORDER, 8, 136, 441, 81
	CONTROL	"Billing", WINORDER_GROUPBOX1, "Button", BS_GROUPBOX|WS_GROUP|WS_CHILD, 6, 25, 219, 90
	CONTROL	"Delivery", WINORDER_GROUPBOX2, "Button", BS_GROUPBOX|WS_GROUP|WS_CHILD, 229, 25, 219, 90
	CONTROL	"Add", WINORDER_PBADDLINE, "Button", WS_TABSTOP|WS_CHILD, 180, 221, 40, 12
	CONTROL	"Delete", WINORDER_PBDELETELINE, "Button", WS_TABSTOP|WS_CHILD, 244, 221, 40, 12
	CONTROL	"Total:", WINORDER_SC_TOTAL, "Static", WS_CHILD, 348, 263, 32, 10
	CONTROL	"Total", WINORDER_TOTAL, "Edit", ES_READONLY|ES_AUTOHSCROLL|WS_TABSTOP|WS_CHILD|WS_BORDER, 396, 263, 40, 11, WS_EX_CLIENTEDGE|WS_EX_RIGHT
END

After FaceLift:

Code: Select all

// This code was originally generated by Facelift Pro
// http://www.piko.com.au/facelift

#using System
#using System.Collections.Generic
#using System.ComponentModel
#using System.Data
#using System.Drawing
#using System.Text
#using System.Windows.Forms

	
BEGIN NAMESPACE Orders

PARTIAL CLASS WinOrder INHERIT System.Windows.Forms.UserControl
        
    PRIVATE INSTANCE components := null AS System.ComponentModel.IContainer

    PROTECT oDCSC_ORDERNO AS System.Windows.Forms.Label
    PROTECT oDCSC_ORDERDATE AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLNAME AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLADD1 AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLADD2 AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLADD3 AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLPOST AS System.Windows.Forms.Label
    PROTECT oDCSC_BILLPHONE AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVNAME AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVADD1 AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVADD2 AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVADD3 AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVPOST AS System.Windows.Forms.Label
    PROTECT oDCSC_DELIVPONE AS System.Windows.Forms.Label
    PROTECT oDCSC_ORDCOMMENT AS System.Windows.Forms.Label
    PROTECT oDCSC_SHIPPING AS System.Windows.Forms.Label
    PROTECT oDCSC_TAX AS System.Windows.Forms.Label
    PROTECT oDCSC_DISCOUNT AS System.Windows.Forms.Label
    PROTECT oDCORDERNO AS System.Windows.Forms.TextBox
    PROTECT oDCORDERDATE AS System.Windows.Forms.TextBox
    PROTECT oDCBILLNAME AS System.Windows.Forms.TextBox
    PROTECT oDCBILLADD1 AS System.Windows.Forms.TextBox
    PROTECT oDCBILLADD2 AS System.Windows.Forms.TextBox
    PROTECT oDCBILLADD3 AS System.Windows.Forms.TextBox
    PROTECT oDCBILLPOST AS System.Windows.Forms.TextBox
    PROTECT oDCBILLPHONE AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVNAME AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVADD1 AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVADD2 AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVADD3 AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVPOST AS System.Windows.Forms.TextBox
    PROTECT oDCDELIVPHONE AS System.Windows.Forms.TextBox
    PROTECT oDCORDCOMMENT AS System.Windows.Forms.TextBox
    PROTECT oDCSHIPPING AS System.Windows.Forms.TextBox
    PROTECT oDCTAX AS System.Windows.Forms.TextBox
    PROTECT oDCDISCOUNT AS System.Windows.Forms.TextBox
    PROTECT oSFWinOrder_DETAIL AS System.Windows.Forms.UserControl
    PROTECT oDCGroupBox1 AS System.Windows.Forms.GroupBox
    PROTECT oDCGroupBox2 AS System.Windows.Forms.GroupBox
    PROTECT oCCpbAddLine AS System.Windows.Forms.Button
    PROTECT oCCpbDeleteLine AS System.Windows.Forms.Button
    PROTECT oDCSC_TOTAL AS System.Windows.Forms.Label
    PROTECT oDCTotal AS System.Windows.Forms.TextBox

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// true if managed resources should be disposed; otherwise, false.

    PROTECTED VIRTUAL METHOD Dispose( disposing AS LOGIC ) AS VOID
        IF disposing && components != NULL
            components:Dispose()
        ENDIF
        SUPER:Dispose( disposing )
        RETURN
    
   
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>

    PRIVATE METHOD InitializeComponent() AS VOID

        SELF:oDCSC_ORDERNO := System.Windows.Forms.Label{}
        SELF:oDCSC_ORDERDATE := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLNAME := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLADD1 := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLADD2 := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLADD3 := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLPOST := System.Windows.Forms.Label{}
        SELF:oDCSC_BILLPHONE := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVNAME := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVADD1 := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVADD2 := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVADD3 := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVPOST := System.Windows.Forms.Label{}
        SELF:oDCSC_DELIVPONE := System.Windows.Forms.Label{}
        SELF:oDCSC_ORDCOMMENT := System.Windows.Forms.Label{}
        SELF:oDCSC_SHIPPING := System.Windows.Forms.Label{}
        SELF:oDCSC_TAX := System.Windows.Forms.Label{}
        SELF:oDCSC_DISCOUNT := System.Windows.Forms.Label{}
        SELF:oDCORDERNO := System.Windows.Forms.TextBox{}
        SELF:oDCORDERDATE := System.Windows.Forms.TextBox{}
        SELF:oDCBILLNAME := System.Windows.Forms.TextBox{}
        SELF:oDCBILLADD1 := System.Windows.Forms.TextBox{}
        SELF:oDCBILLADD2 := System.Windows.Forms.TextBox{}
        SELF:oDCBILLADD3 := System.Windows.Forms.TextBox{}
        SELF:oDCBILLPOST := System.Windows.Forms.TextBox{}
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Porting VO Forms to Winform or WPF

Post by Jamal »

Please sse attached FaceLift samples as provided by Paul Piko.
Attachments
FaceliftExamples.zip
(609.88 KiB) Downloaded 73 times
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Porting VO Forms to Winform or WPF

Post by Chris »

Jamal wrote: Therefore, I see this as a big obstacle in migrating VO to Winforms (at least), and the questions will we ever see a similar tool like Facelift integrated in VS or be part of the xPorter?
That's pretty easy actually, especially in XIDE (VIDE back then) there has been a feature to create a Windows Form out of a VO window since many years ago. For VS it is a little more complicated, but still should not be difficult. But of course this can only serve as a very starting point, because none of the existing VO GUI code (that has to do with the GUI) can be reused in WinForms...
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Porting VO Forms to Winform or WPF

Post by Jamal »

Chris wrote: That's pretty easy actually, especially in XIDE (VIDE back then) there has been a feature to create a Windows Form out of a VO window since many years ago..
Hi Chris,

Do you mean there was a feature and it longer exists in XIDE?
I've looked and cannot find such a feature in XIDE.

Jamal
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Porting VO Forms to Winform or WPF

Post by wriedmann »

Hi Jamal,
I agree with Chris that such a functionality is not too hard to write.
I was interested too in Facelift, but transporting only the windows to WinForms is only a small part of work.
Therefore I see the alternate GUI classes a better tool for a migration.
Since they are based on Windows Forms, a mix of native Windows Forms forms and windows moved over from the VO GUI classes should be possible.
But (and that is valid for both methods) the bBrowser is a very important component of my applications, and I have my doubts about its migration.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Porting VO Forms to Winform or WPF

Post by Chris »

Hi Jamal,

It was a little hidden on purpose back then :). You need to first port the VO windows (their AEF) into an X# project, open that project, create a new WinForms app, create a new windows form and in the designer at the toolbar, select Form Designer Commands->Import from VO window, now a dialog will open with the available VO windows in the project to import from.

It is a bit clumpy, but it was not a much requested feature, so I never improved it, actually had completely forgotten about myself until I saw your post which reminded me of it :)
Jamal wrote:
Chris wrote: That's pretty easy actually, especially in XIDE (VIDE back then) there has been a feature to create a Windows Form out of a VO window since many years ago..
Hi Chris,

Do you mean there was a feature and it longer exists in XIDE?
I've looked and cannot find such a feature in XIDE.

Jamal
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Jamal
Posts: 315
Joined: Mon Jul 03, 2017 7:02 pm

Porting VO Forms to Winform or WPF

Post by Jamal »

Hi Chris,

I tried to follow the steps you outlined, but it is not clear and thus it is a no go! This is not important right now.
What is important FaceLift equivalent is needed which is part of the X# product.

I am surprised that was not a popular requested feature; it's possible that other developers did not embrace Vulcan.NET at the time or even X# until now, but Paul Piko did and created the FaceLift product. However, Vulcan.NET is no longer here and X# was not ready for prime time and FaceLift is not longer maintained . Now that X# is a more mature .NET development tool, for me at least, it's critical as I do not wish to use the old migrated xPorted VO data windows in a .NET app which look plain :evil: Therefore a product like FaceLift is a necessity to make the migration to real .NET or WPF forms.

FaceLift does not convert VO code to .NET, just the forms which is what is needed. XPorter does a great job converting VO code; now combine both into one TOOL and you have a winner. I understand not all controls will equivalents (those can have placeholders) and some code changes are needed to access the properties of native .NET controls.

Jamal
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Porting VO Forms to Winform or WPF

Post by wriedmann »

Hi Jamal,
personally I don't see any bigger problem "translating" a VO window to a WinForms window in the manner as Facelift has done it - or better, it seems to be an relatively easy task compared to all the other things that the development team has done on the compiler and the runtime.
But nearly all VO applications I have seen had a lot of business logic in the window classes, and that code is hard to move over to Windows Forms (or even harder to WPF).
When searching a migration strategy for my own applications I had also contacted Paul about FaceLift, but had discarded this way.
I'm not much more interested in the alternate GUI classes.

But if you are so interested in a window translator tool: why don't write such a tool ourself? After all, X# should not only be a project of the current team. but should involve also us users.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply