Hello Community,
I am trying to build a dialogue box with report. In this dialog box I would like to have a text box, in which the content can change according to another check box in the dialogue. If the check box is chosen, then the text box will show "A", and if the check box is not chosen, the text box will show "B". I have built two text boxes at the same location and I want to use setVisible() to control which text to be shown. However, if seems that if two text boxes overlap, one of the text box can not be shown correctly. (I've try to move one of the text box to a free place, then everything works well.) I am not sure if it's possible to do this with report. Can anyone help?
Thanks in advance!
I advise against this approach. Instead I would recommend one button and you simply change the text it displays.
Example:
function myDialog() { this.getPages = function() { this.currentButtonSetting; var iDialogTemplate1 = Dialogs.createNewDialogTemplate(200, 200, "First page"); iDialogTemplate1.PushButton(35, 5, 80, 15, "A", "BUTTON_1"); iDialogTemplate1.CheckBox(120, 5, 100, 15, "Press", "CHECKBOX_1"); iDialogTemplate1.Text(35, 30, 100, 16, "sampleText", "TEXT_1"); return [iDialogTemplate1]; } this.init = function(aPages) { currentButtonSetting = "A"; } this.CHECKBOX_1_selChanged = function(newSelection) { if(newSelection == 0){ this.dialog.getDialogElement("BUTTON_1").setText("A"); currentButtonSetting = "A"; } else { this.dialog.getDialogElement("BUTTON_1").setText("B"); currentButtonSetting = "B"; } } this.getResult = function() { return currentButtonSetting; } this.BUTTON_1_pressed = function() { if(currentButtonSetting == "A"){ this.dialog.getDialogElement("TEXT_1").setText("Button behavior A"); } else { this.dialog.getDialogElement("TEXT_1").setText("Button behavior B"); } } } var result = Dialogs.showDialog(new myDialog(), Constants.DIALOG_TYPE_ACTION, "Dialog"); Dialogs.MsgBox(result);
I've also included an example how to make use of the different button states, because obviously you can't write two different button reaction methods anymore.