form property names

Hi:

Is there an equivalent of
Table.setColumnHeaders
for a form?

regards, and thanks!!!


setVisibleItemProperties(Collection)

Thank you very much for your answer Tobias, but isn’t that for displaying or not displaying properties? that would be equivalent to
setVisibleColumns
, not
setColumnHeaders
…Am I right?, if not, how can I change the property names that are displayed?

regards, and again, thank you very much…

Ouch, misread your question, sorry. Well, there is no exact equivalent, but you can either get the fields from the Form by using a combination of
getField(Object)
and
getItemPropertyIds()
and the set the Caption of the fields or (probably more easy) just use a
FormFieldFactory
. In that Factory you can not only set the caption of the field but also change the type of displayed field if necessary.

I tried to do that:

form.getField(form.getItemProperty("HoursFromHouse")).setCaption("Hours");

but I get a null pointer exception…I can’t use the form field factory because I need to change the captions of a lot of fields, and I don’t want to create that many secondary fields just to change the names of them…do you see what I’m doing wrong here?

thank you for all your help Tobias…

Yeah, you need to give the property-ID (“HoursFromHouse”) as argument to getField() not the property itself.

What do you mean by “create that many secondary fields just to change the names”? With FormFieldFactory you are not creating fields that “live” beside the ones the Form uses, but you actually create the “real” ones! So there are no “secondary fields” involved, you just get more control over the creation-process of the actual fields.

I did try that:

formRev1.getField("HoursFromHouse").setCaption("Hours");

…but I also get a nul pointer exception…

I said that of creating too many fields because I’m using a MySQL table as the item data source, and I want to display the values directly from it…

Thank you very much for your help Tobias…

Well probably the field-generation is not yet done then … Have you set the ItemDatasource for the Form before trying to set the captions?

The FormFieldFactory is probably the really better way to do it - don’t worry about generating too much fields, the Form needs the fields anyways, you are just changing the way how they are created.

Amazing,
form.getField(“HoursFromHouse”).setCaption(“Hours”);
worked perfect, all I had to do is place it
AFTER
setting the item data source…

Thank you very very much for all your help Tobías, I really appreciate it…

regards,

Hugo