Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC:

VS replaces tabs by spaces 14 Sep 2021 12:27 #19599

  • KeesIC2
  • KeesIC2's Avatar


  • Posts: 49
  • One more strange replacement by the Winforms designer in VS. After making a totally unrelated small change in the window (I added a button) and saving, the following line of code:

    PROTECTED aEmacc AS ARRAY OF EAccount // Holds objects of type EAccount

    had changed to these 2 lines:

    PROTECTED aEmacc AS VOID
    // Holds objects of type EAccount

    So the type was changed to VOID and the line was split. Of course it caused a compilation error ("Field cannot have void type") which was easy to correct but it is weird that this code was changed.

    Added note: It may be easy to change back but I have to do it every time I change something on the form!

    Please Log in or Create an account to join the conversation.

    Last edit: by KeesIC2.

    VS replaces tabs by spaces 14 Sep 2021 14:46 #19600

    • Chris
    • Chris's Avatar


  • Posts: 3974
  • Kees, thanks for your report, I see the problem as well. Will log it for Robert to look into it.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 15 Sep 2021 15:25 #19605

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1662
  • Hello Chris,

    Chris wrote: Kees, thanks for your report, I see the problem as well. Will log it for Robert to look into it.


    I was curios about one thing: this is an error which should come up for everyone using X# & Winforms en VS when editing something in a Winform.

    Is Kees the first one using this combination? I would say this is the most common way of using X# except for those who left all on VO forms or those who use WPF?

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 15 Sep 2021 15:32 #19606

    • robert
    • robert's Avatar


  • Posts: 3588
  • Dick,

    This problem only happens (in your build) when you declare a field "AS ARRAY OF <something>".
    I have fixed this today in our internal build.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 15 Sep 2021 23:51 #19609

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1662
  • Hello Robert,

    robert wrote: I have fixed this today in our internal build.


    That is (again) amazingly fast!

    Dick

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 20 Sep 2021 10:04 #19644

    • KeesIC2
    • KeesIC2's Avatar


  • Posts: 49
  • Hi,

    On docs.xsharp.it/doku.php?id=codesamples:initalizing_net_array I read that an array can be initialized with:

    local aNumbers as int[]

    So I thought instead of:

    PROTECTED aEmacc AS ARRAY OF EAccount

    which gets corrupted by the designer, I could use:

    PROTECTED aEmacc AS EAccount[]

    But this behaves differently, I get error XS0266 ("Cannot implicitly convert type 'ARRAYBase<iConnectEmail.EAccount>' to 'iConnectEmail.EAccount[]'.") on the line:

    SELF:aEmacc := GetAccountData()

    where GetAccountData is defined as follows:

    FUNCTION GetAccountData() AS ARRAY PASCAL

    and error XS1503 ("Argument 1: cannot convert from 'iConnectEmail.EAccount[]' to 'ARRAYBase<iConnectEmail.EAccount>'") on the line:

    dwFrom := GetDefAccNum(SELF:aEmacc)

    where GetDefAccNum is defined as follows:

    FUNCTION GetDefAccNum(aAccounts AS ARRAY OF EAccount) AS DWORD PASCAL

    What is the difference between AS ARRAY OF EAccount and AS EAccount[] ?

    Another question: is there any benefit in adding PASCAL or STRICT? In the documentation it says "Most calling conventions are for backward compatibility only." Can I just remove the PASCAL and STRICT without any consequence?

    Kees.

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 20 Sep 2021 10:10 #19645

    • FFF
    • FFF's Avatar


  • Posts: 1419
  • Kees,
    AFAIU, ARRAY is an array of Usuals, EAccount[] is an Array of "typed" EAccount members, which certainly is not "equal".
    What happens, if you write FUNCTION GetAccountData() AS EAccount[] ?
    Regards
    Karl (X# 2.15.0.3; Xide 2.15; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 20 Sep 2021 10:20 #19646

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • Hi Kees,

    What is the difference between AS ARRAY OF EAccount and AS EAccount[] ?


    "AS ARRAY OF EAccount" is a VO style dynamic array, on which youn can work with the VO array functions like AADD(), AScan(), ASort() etc.
    "AS EAccount[]" is a fixed size .NET array.

    The first one cannot be used in Core dialect applications, because the .NET Framework does not knows nothing about the xBase ARRAY datatype.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    VS replaces tabs by spaces 20 Sep 2021 11:01 #19647

    • Chris
    • Chris's Avatar


  • Posts: 3974
  • Hi Kees,

    Regarding using STRICT/PASCAL:

    When a method definition has typed parameters like that:

    METHOD Test(n AS INT) AS STRING

    then the compiler knows this is a STRICT calling convention method, so you do not need to specify it yourself.

    When it uses untyped parameters:

    METHOD Test(n)

    then the compiler automatically emits it as a CLIPPER method.

    Problem is when there are no parameters in the method

    METHOD Test()
    METHOD Test() AS INT

    In both cases, the compiler does not know for sure what your intention is. There is a compiler/project option for that, "Implicit Clipper calling convention" (/vo5), found in the "Dialect" page of the project properties. When this option is enabled, then parameterless methods become CLIPPER by default, otherwise they are emitted as STRICT. This was introduced in order to make code compatible with VO, where methods are CLIPPER by default.

    So, if you have this option enabled and want to make such a (parameterless) method emitted as STRICT, then you need to specify the keyword. If you have the option disabled, then there's no need to specify STRICT, the method becomes STRICT by default. When a method does include typed parameters (as in your specific example), then you do not need to specify it, the method again becomes STRICT automatically.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    • 2