2

Is there any way to do that?

I mean, if the form fullfill specific conditions setVisible true or false to a control in the form? Or if i check a CheckBox, show some specific ComboBox?

Thanks in advance for your help

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
JGutierrezC
  • 4,398
  • 5
  • 25
  • 42

2 Answers2

3

I would recommend enabling and disabling fields, rather than hiding them.

Open a Supplier, and on the Invoice and Delivery fast tab choose select the Calculate withholding tax CheckBox. This is the VendTable form. The Calculate withholding tax control will enable and disable a second control depending upon the value selected.

VendTable.TaxWitholdCalculate

The second control has it's property AutoDeclaration set to Yes, and the event that fires the change can be found on the forms VendTable data source. Find the relevant field (VendTable > Data Sources > Vend Table > Fields > TaxWithholdCalculate) and notice that the modified method has been overridden, changing the control's enabled property. It also has a visible property should you want to remove it from view.

VendTable.TaxWitholdCalculate2

Top Tip: In case that you are not aware, you can right click on any control on a form and choose the Personalise option from the context menu. From there is a form which contains a very useful box called System name. You can find the name of the control/table field from this.

VendTable.TaxWitholdCalculate3

ian_scho
  • 5,906
  • 9
  • 35
  • 51
  • "I would recommend enabling and disabling fields, rather than hiding them." Totally agree with that. The main reason for this is that when you dynamically hide / show controls, your form will shift controls due to Morphx handling layout of fields in groups. – Kenny Saelen Oct 20 '13 at 08:31
  • @KennySaelen so you're saying that MorphX can't handle it well? – Tassisto Oct 29 '13 at 12:19
  • "I would recommend enabling and disabling fields, rather than hiding them." I would say in 99% of situations I have seen there has been a very good reason for hiding a UI field. – AnthonyBlake Nov 04 '13 at 08:40
0

I suggest you this solution for your second problem:

if i check a CheckBox, show some specific ComboBox?

I assume your form is complete (it has all controls needed : comboboxes, checkboxes, etc). And the controls AutoDeclaration-property is set to 'Yes'.

  1. In the AOT expand the Form till you find the CheckBox, expand it as well
  2. Right-click its Methods and select 'Override method' >> 'Clicked'
  3. Finally you can add this code and save/compile the form: myComboBox.visible(true);

It should look like:

public void clicked()
{
    super();
    myComboBox.visible(true);
}
Tassisto
  • 9,877
  • 28
  • 100
  • 157