Change text of a button in Form after closing a Dialog

10 views
Skip to first unread message

stema...@gmail.com

unread,
Jul 29, 2017, 11:40:01 AM7/29/17
to CodenameOne Discussions
Hi,

I show a Dialog on click of a button in a Form like so:

Dialog dialog = (Dialog)createContainer(fetchResourceFile(), "ClockDialog");
dialog.show();

In this Dialog I have a Button and on each event I want to set the text of a Button which exists in the parent Form.

The code I tried on the dialog's button event doesn't work:

Form f = (Form)createContainer(fetchResourceFile(), "PostGame");
       
        Button timeBtn = (Button)findByName("Button3", f);
        timeBtn.setText("AAAAAA");
       
        dialog.dispose();

How can I do this?

Thanks in advance

Shai Almog

unread,
Jul 30, 2017, 1:13:36 AM7/30/17
to CodenameOne Discussions
Hi,
Dialog.dispose() implicitly shows the "previous" form. You will need to show your form after dispose.
Reply all
Reply to author
Forward
0 new messages