OLE_Color Type

StaminosStaminos Member Posts: 68
Hi,

I try to use method ShowColor from Common Dialog.
Afterwards, I try to get the selected Color with the property Color which is a OLE_Color variable type.

But how can we declare an OLE_COLOR variable in Navision ?

Answers

  • ara3nara3n Member Posts: 9,256
    You can't. LS Retail has a com that does that.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • azwierzchowskiazwierzchowski Member Posts: 15
    You can use Microsoft Script Control to convert OLE_COLOR to integer

    Variables:

    VariantVal : Variant
    Script: Automation 'Microsoft Script Control 1.0'.ScriptControl"
    ColorDialog: OCX 'Microsoft Common Dialog Control, version 6.0'"
    ColorValue : Integer

    and code:

    CREATE(Script);
    Script.Language := 'VBScript';
    VariantVal := Script.Eval(ColorDialog.Color);
    ColorValue := VariantVal;
  • StaminosStaminos Member Posts: 68
    Thank

    It was so easy....


    Fingers in the noses !
  • ACAEACAE Member Posts: 52
    Has anyone got this working in the Role tailored client ? I get the following error:

    "Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavAutomation to System.String."

    This is the code that gives the error:

    liColor := lautConvColorToInt.Eval(locxCommonDialogControl.Color);

    I tried to replace the liColor (integer) with a variant, and this works, but then I can't convert the variant to an integer

    Thx,
    Andy
  • kinekine Member Posts: 12,562
    I think that it is problem of using OCX on RTC. Do not forget that the automation is created on service tier by default (I am not sure if it is true for OCX too, but for Automation it is true, but you can change it by parameter of CREATE, but this is not used for OCX).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jhoekjhoek Member Posts: 216
    My machine did not have the Script Control installed, for some reason, so I tried to find an alternative solution, as described here: http://mibuso.com/blogs/zenandtheartofc ... og-part-i/.
    Kind regards,

    Jan Hoek
    Product Developer
    Mprise Products B.V.
  • Arne_RosenfeldtArne_Rosenfeldt Member Posts: 13
    On RTC:
    The commonDialog has a .NET wrapper.
    Instead of using VB, you write C# like .NET code.
Sign In or Register to comment.