Custom Control Properties

Posted by jason aubert on 15-May-2018 08:47

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

Posted by Lieven De Foor on 17-May-2018 04:02

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.

Posted by Mike Fechner on 15-May-2018 08:51

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.

All Replies

Posted by Mike Fechner on 15-May-2018 08:51

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.

Posted by jason aubert on 16-May-2018 12:43

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?


Posted by Lieven De Foor on 17-May-2018 04:02

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.

Posted by jason aubert on 17-May-2018 13:24

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

Posted by Mike Fechner on 17-May-2018 13:28

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.
 

Posted by jason aubert on 18-May-2018 09:40

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?

Posted by jason aubert on 18-May-2018 10:54

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!

This thread is closed