donderdag 8 oktober 2009

DialogField.fieldControl - the hidden code...

In http://axaptapedia.com/Mandatory_DialogField I came across a method "mandatory" that is not shown by MorphX IntelliSense.
It seems that there is more "hidden" stuff to the fieldControl of a DialogField.

For example, I needed to get the label from a DialogField that I've added.
Setting the label is done with myDialogField.label(myLabelText)
This method is defined as void label(FieldLabel label)
And it is shown by IntelliSense when we type myDialogField.

But getting the label is a different story.
There is no getLabel, and the label method is implemented as void, so there's no return value.
The trick is to go through the fieldControl.
BUT! The method we need, which is label(), is not shown by IntelliSense when we type myDialogField.fieldControl().
That doesn't mean it not there though.
So, getting the label is done like this: myDialogField.fieldControl().label()

It seems that most of the properties of an object can be retrieved this way, even if they don't show up in IntelliSense.

update:
I've discovered a plausible reason as to why the methods/properties don't show up in IntelliSense.
The fieldControl() method returns an Object.
Of course, Object doesn't have a label property, mandatory method, etc...
That's probably why it doesn't show up in IntelliSense.

I suppose that when you execute fieldControl().label() against an object that doesn't have a label() method, there will be a runtime error.

Geen opmerkingen:

Een reactie plaatsen