How do I add a Label to a display method in Dynamics AX 2009? - dynamics-ax-2009

I would think you should be able to define a label on a display method. However, I can't see it in the properties window. But there is a Best Practice Warning:
Control label is a copy of its display method label
So who can either tell me how to add the label or what this error message is really about?

The return type for the display method should be an Extended Data Type. On the EDT you should supply the label.

Each form control must have a label either inherited from EDT/Enum or explicitely set on the control. The label set on the control must not be the same as the EDT/Enum's label. I suppose in your scenario it is the same, and in order to get rid of this BP warning you should just clear the label in the control properties. If you want the label to be different you can change it in the control properties or in the Extended Data Type/Base Enum properties but then it will be changed everywhere througout the system.

Related

How to set the default writing direction for NSTextView?

I'm trying to set up a text view that a user can type Hebrew text into from right-to-left. Currently it defaults to a left-to-right text direction, which the user can manually change by right-clicking and selecting "Writing Direction > Right to Left", but what I need is for the text view to always default to this, without requiring the user to set it manually.
There's an option for setting this in Interface Builder, which is always ignored when I build and run my app.
I would be fine setting it from code, but I can't figure out how to use the method that looks like the closest thing to what I need:
hebrewTextView.setBaseWritingDirection(NSWritingDirection.RightToLeft, range: <#NSRange#>)
The range is stumping me. If it takes a range can this be the method I need? Wouldn't the default behavior of a field be independent of any range of text?
Is there a way to set the default writing direction for a NSTextView? Can this be done from the storyboard/interface builder, or from code? If setBaseWritingDirection is the method for this, what is the range value for and how would I set it for a field that is initially empty?
NSTextView inherits from NSText. NSText has a baseWritingDirection property. Try setting that:
hebrewTextView.baseWritingDirection = NSWritingDirection.RightToLeft
It also inherits the action method makeBaseWritingDirectionRightToLeft() from NSResponder, which presumably what the contextual menu uses. So, you could call that.
If neither of those works, you can set the text view's defaultParagraphStyle to one whose baseWritingDirection is right-to-left:
var style = hebrewTextView.defaultParagraphStyle.mutableCopy() as! NSMutableParagraphStyle
style.baseWritingDirection = NSWritingDirection.RightToLeft
hebrewTextView.defaultParagraphStyle = style

Move Vaadin Slider

When I am invoking slider.setValue() it changes internal field value but not graphical representation of slider.
How to move slider to given value from server side? (For example on button click or something like this. Value change is invoked from other component.)
I have set slider.setImmediate(true); and after changing value called slider.requestRepaint(); but this did not helped.
You may check its' parent components and also check for the component which invokes this method in its' listener.

How to know which slider is selected

I have multiple sliders in my application,how to know which slider is selected. And how to set the slider values to integer type where double is default type;
You can use the Tag property of the slider to assign an integer (or even better, use an enum). This is useful if you have multiple buttons or controls with the same target.
The sender will be the control that triggered the action, and you can get the tag from that. You can also cast back to the original control type if you need to access other properties.
See Objective C IBOutlets for information on the sender.
Also note that normally you would set the tag in Interface Builder (IB), but you can also set them in code.
You should set up the slider to target a method when it changes, that way you can be informed when a slider changes. You should do this in interface builder but if for some reason you can't, perhaps you have to dynamically determine the sliders needed then you can use methods like
[NSControl setAction:]
[NSControl setTarget:]
NSControl can have their value set with various data types (int, float, double) even some types that are not applicable to NSSliders (for example NSString), their is no default type, just use the following method.
-[NSControl setIntValue:]

Dynamics AX 2009 Report: LabelPosition above does not work?

I'm just in the process of changing the SalesInvoice Report. One thing I'm trying to do is show the label of some items not left of the item value but above it instead.
Seems easy enough: just change the LabelPosition (for example from CustInvoiceJour_InvoiceId) setting from "left" to "above" and voila: the label has vanished. It is just shown nowhere at all.
Strange. I would have expected the label to show up, well, above the content. Not to vanish.
Am I missing something (there is no label height to set), or is this functionality broken?
I'm not sure if this functionality is broken. But in generated design, these elements will not show the label if it's set to above:
Prolog
PageHeader
Header
Footer
Epilog
ProgrammableSection
If the item you're trying to change is in one of those, then the label position above will, from my experience, not work.
My tip is to create a new control of the text type and then use the same label that the extended data type for the field uses under the "text" property and then adjust the position so it is positioned above the field you're trying to set a label on.
From what I have noticed for a ProgrammableSection the column name labels are not shown only on the first page of the report. The labels are shown on the next pages.

ActiveX control default property discovery

Is it possible to determine which property of an ActiveX control is the default property? For example, what is the default property of the VB6 control CommandButton and how would I found out any other controls default!
/EDIT: Without having source to the object itself
I don't use VB, but here it goes.
I found Using the Value of a Control, but it's not a programmatic solution.
If you have access to the code, look for
Attribute Value.VB_UserMemId = 0
using Notepad.
It depends on when you want to determine this. You could print the "value" of, say, a label control (which has no "value" property) to the debugger like:
debug.print "Value for cmdTest is ["+format(cmdTest)+"]"
Which will give you something like:
Value for cmdTest is [False]
As it turns out, the default value for a command button is it's state (pressed or not), so if you put the code example above in the click event for the control, you will see "True", if you execute it somewhere else, you'll see "False".
For other results, this method will at least show you the sort of property you're looking for. You could use:
debug.print "cmdTest's value is of type ["+TypeName(oObject) +"]"
which tell you the actual type, namely:
cmdTest's value is of type [Boolean]
You could use various methods to narrow things down, such as setting the value and seeing what happens.
Use OLE/Com Object Viewer, which is distributed with Microsoft Visual Studio.
Go to type libraries and find the library the control is housed in, for example CommandButton is stored in Microsoft Forms 2.0 Object Library. Right click the library and select view. Find the coclass representing the control and select it:
As can be seen, the default interface for CommandButton is ICommandButton, when you inspect ICommandButton look for a property that has a dispid of 0. The IDL for the dispid 0 property of CommandButton is:
[id(00000000), propput, bindable, displaybind, hidden, helpcontext(0x001e8d04)]
void Value([in] VARIANT_BOOL rhs);
[id(00000000), propget, bindable, displaybind, hidden, helpcontext(0x001e8d04)]
VARIANT_BOOL Value();
Showing you the default property.
you have access to the code, look for
Unfortunetly I don't have access to the code for most of the controls. However the link is useful for the Microsoft Controls, but I still would like a way to know for other controls.

Resources