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
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.
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.
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.
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?
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!