Automatically Disable a Button

It’s a weird thing that I have a button (let’s name it as Button1) where its AutoDeclaration property is set to YES. This button is place in the first form and is a MenuItem Action button where it calls a class and runs a form - second form. In the first form I have a method that will refresh the entire form see my code below.

void refreshForm()
{
    common          curRec;
    ;
    
    curRec = AJournalTable.data();
    //Assume the condition will return true
    if(AJournalTable_ds.isOK(curRec))
    {
        Button1.enabled(false);
    }

    AJournalTable_ds.refresh();
    AJournalTable_ds.research(true);
    AJournalTable_ds.reread();
    AJournalTable_ds.executeQuery();
}

The method above is called and invoke in the second form’s class.

if (_args.parmEnum() == RunChoose::Run)
{
    _args.caller().doRefresh();
}

When the second form closes, still the Button1 is enabled. Any idean from you guys?

if (formHasMethod(_args.caller(),identifierstr(refreshForm)))
_args.caller().refreshForm();

You should also have the enable/disable logic in active method of the form data source.