
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Visual Cobol #region problem
Hi!
I will convert this c# code snip in Visual Cobol code:
==============================================================================
#region MinimumValue Property
public static double GetMinimumValue(DependencyObject obj)
{
return (double)obj.GetValue(MinimumValueProperty);
}
public static void SetMinimumValue(DependencyObject obj, double value)
{
obj.SetValue(MinimumValueProperty, value);
}
public static readonly DependencyProperty MinimumValueProperty =
DependencyProperty.RegisterAttached(
"MinimumValue",
typeof(double),
typeof(TextBoxNumeric),
new FrameworkPropertyMetadata(double.NaN, MinimumValueChangedCallback)
);
private static void MinimumValueChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TextBox _this = (d as TextBox);
ValidateTextBox(_this);
}
#endregion
==============================================================================
I know that #Region = $Region is...
But how can i convert the rest?
Have anyone an idea?
Best Regards
Bernd Riemke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Region is only used to make source code easier to read, so it can be ignored. It's not clear to me why your title refers to it as a "problem".
Ignoring the region directive, the COBOL equivalent would be along these lines:
*> I don't think COBOL has an equivalent of C#'s "readonly", so I'm making this a read-only property
01 minimumValueProperty type DependencyProperty
value type DependencyProperty::RegisterAttached(
"MinimumValue"
type of binary-float
type of type TextBoxNumeric
new FrameworkPropertyMetadata(binary-float::NaN, MinimumValueChangedCallback)
)
static property as "MinimumValueProperty" with no set.
method-id GetMinimumValue(obj as type DependencyObject) returning result as float-long static.
set result to obj.GetValue(MinimumValueProperty) as float-long
end method.
method-id SetMinimumValue(obj as type DependencyObject, #value as float-long) static.
invoke obj::SetValue(MinimumValueProperty, value)
end method.
method-id MinimumValueChangedCallback(d as type DependencyObject,
e as type DependencyPropertyChangedEventArgs)
static private.
declare _this as type TextBox
if d instance of type TextBox
set _this to d as type TextBox
end-if
invoke ValidateTextBox(_this)
end method.
That's untested, but it would be something along those lines. If you could be more specific about your problem, we might be able to be more helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You can use "INITIALIZE ONLY" to make a field read-only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
documentation.microfocus.com/.../GUID-160C3A93-45A9-4F03-A6F5-CACD9F848C98.html