Hello guys,
How will look this C# line in ABL?
private Stack<UndoEngine.UndoUnit> undoStack = new Stack<UndoEngine.UndoUnit>();
tried to do something like this and it doesn't work
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack<UndoEngine.UndoUnit>" NO-UNDO.
and also maybe you can help me with these C# lines?
using ( SerializationStore serializationStore = componentSerializationService.CreateStore() ) {
foreach ( object obj in objects ) {
if ( obj is Control ) componentSerializationService.Serialize ( serializationStore, obj );
}
}
Thank you!
I think I need to see that in a larger scope than just those lines you are struggling with, especially the "[this]" as this might refer to the default indexer of the class itself.
function(){return A.apply(null,[this].concat($A(arguments)))}
is not a part of my code, this code PSDN web side sometimes adds to our posts . sorry
private Stack undoStack = new Stack();
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack" NO-UNDO.
Version is important when it comes to generics: you need to be on at least the latest 10.2A service pack, if not 10.2B (no coffee yet this morning so I'm not 100% sure :).
using ( SerializationStore serializationStore =
componentSerializationService.CreateStore() )
Use CAST(): serializationStore = CAST(componentSerializationService.CreateStore(), SerializationStore)
foreach ( object obj in objects ) {
This will depend on what the type of objects is (Array, collection). You might need to use
do i = 1 to objects:Length()
or alternatively get an iterator object, and operate on that.
if ( obj is Control )
If type-of(obj, Control) then ....
-- peter
I'm using OpenEdge 10.2B. And this line doesn't work:
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack" NO-UNDO.
even if I put to the top of source:
using System.ComponentModel.Design.*.
also, maybe you have example how to work with:
foreach ( object obj in objects ) {
Thank you!
The generic Stack class requires
USING System.Collections.Generic.* .
This compiles in 10.2B for me:
DEFINE VARIABLE UndoStack1 AS "Stack" NO-UNDO.
And the line below doesn't for some reason. This is probably why you're seeing errors. I'd speak to Tech Support about this.
def var o1 as class System.ComponentModel.Design.UndoEngine.
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack" NO-UNDO.
As a rule of thumb, take a look in Architect's Class Browser. If a class appears there, it's good to use.
Also, you can reference inner classes (such as " UndoEngine.UndoUnit") as "UndoEngineUndoUnit". Notice the '.' has been replaced with ''.
-- peter
pjudge schrieb:
private Stack undoStack = new Stack();
And don't forget to NEW your Stack. The above line defines it and NEW's it.
Add something like
undoStack = NEW "Stack
also, maybe you have example how to work with:
foreach ( object obj in objects ) {
>
Assuming "objects" is defined as type "System.Object[]" or System.Object extent,
Def var obj as System.Object.
do i= 0 to objects:Length - 1:
obj = objects[i].
/* do something with obj */
End.
There is also a C#-to-ABL mapping guide at http://communities.progress.com/pcom/docs/DOC-16316 that may be useful.
-- peter
found how to fix this
you need to use :
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack" NO-UNDO.
instead of:
DEFINE PRIVATE VARIABLE UndoStack AS CLASS "Stack" NO-UNDO.
is there any way how you can implement in ABL something like this?
[Description("Sets the Angle"),
Category("Values"),
DefaultValue(0),
Browsable(true)]
public int MyProperty
{
//...
}
No. I have experimented with the ICustomTypeDescriptor Interface that allows that - look's promising but requires a lot of work.
But there is no support for this natively in the ABL.