Custom Control Properties - Forum - OpenEdge General - Progress Community

Custom Control Properties

 Forum

Custom Control Properties

This question is answered

I have created a custom control and have added some basic logical properties to it.  I want to be able to add a property that has drop-down choices such as

controlLayout     -> Default

-> Horizontal line

-> Vertical Line

-> no label

I cannot figure out a way to be able to create a property like this and have not been able to find any posts related to creating a property like this.

Does anyone know if this is possible and if so, provide an example.

Thank you

Verified Answer
  • GUI for .NET ?

    The easiest is to create a .NET Enum in Visual Studio for that property type.

    Otherwise you'll have to start implementing custom type descriptors ... which is not a lot of fun.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • It should be a .NET enum, not an ABL enum...

    By the way, your SET implementation is not assigning any value, so that won't work in code either...

    Either just write

    SET.

    or

    SET (arg AS LayoutOptions):

        ASSIGN ControlLayout = arg.

    END SET.

All Replies
  • GUI for .NET ?

    The easiest is to create a .NET Enum in Visual Studio for that property type.

    Otherwise you'll have to start implementing custom type descriptors ... which is not a lot of fun.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • I created the ENUM with 4 options.  Defined a public property in my control form as the ENUM.

    But the property does not show up in the properties view of my control form visual designer.  

    DEFINE PUBLIC PROPERTY ControlLayout AS Shared.controls.ui.grid.LayoutOptions NO-UNDO
            GET.
            PUBLIC SET (layoutStyle AS shared.controls.ui.grid.LayoutOptions):
            END SET.

    the enum is defined as the following:
    ENUM shared.controls.ui.grid.LayoutOptions:
        DEFINE ENUM Normal
                    NoLabel
                    HorizontalLine
                    TopLabel
                    VerticalLine
                    .
    END ENUM.

    Is there anything that I am missing, or need to do in order to make this show up in the properties view?


  • It should be a .NET enum, not an ABL enum...

    By the way, your SET implementation is not assigning any value, so that won't work in code either...

    Either just write

    SET.

    or

    SET (arg AS LayoutOptions):

        ASSIGN ControlLayout = arg.

    END SET.

  • How do I define a .Net Enum in progress openedge?

  • In Visual Studio. Build your own .NET Class Library and use that in OpenEdge (by referencing it in assemblies.xml).
     
    Von: jason aubert <bounce-jaubert@community.progress.com>
    Gesendet: Donnerstag, 17. Mai 2018 20:26
    An: TU.OE.General@community.progress.com
    Betreff: RE: [Technical Users - OE General] Custom Control Properties
     
    /cfs-file/__key/communityserver-discussions-components-files/26/65387.image001.png
    Update from Progress Community
    /cfs-file/__key/communityserver-discussions-components-files/26/2055.image002.png
     

    How do I define a .Net Enum in progress openedge?

    View online

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.

    Das Bild wurde vom Absender entfernt.
     

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • I have defined my property

    DEFINE PUBLIC PROPERTY ControlLayout AS LayoutLibrary.LayoutOptions NO-UNDO

    GET.

    PUBLIC SET(layoutStyle AS LayoutLibrary.LayoutOptions):

    ASSIGN ControlLayout = layoutStyle.

    END SET.

    And I defined the .net Enum in Visual studio

    using System;

    namespace LayoutLibrary{

    public class LayoutOptions {

    public enum Options { NoLabel, TopLabel, HorizontalLine, VerticalLine, Default }

    }

    }


    and imported the .dll file into the assemblies.xml.

    The property is defined and shows up but it looks as if the property is disabled and the options are not available (IE no dropdown menu) 

    Is there something wrong with the way I defined my ENUM?

  • I got this working I had to change my .net class library to the following:

    using System;

    namespace LayoutLibrary

    {

       public enum Options {   NoLabel = 1,

                               TopLabel = 2,

                               HorizontalLine = 3,

                               VerticalLine = 4,

                               Original = 0                          

                           };

       }


    Thanks for the help everyone!