Consultor Eletrônico



Kbase 19466: Code example for catching the answer of an abMsgBox
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   30/01/2000
Code example for catching the answer of an abMsgBox with Apptivity 3.2

The answer of an abMsgBox is send to the Object specified within the constructor of the abMsgBox as "responseTo", which while construction will than automatically be added to the list of Observers for the abMsgBox calling it's update method if the abMsgBox object gets changed.

Specifying inside an abForm "this" as "responseTo" the answer will
be send to the form.

The only thing than still to do is to change the update method of the
form to add the code for finding the containing answer in the received
object and off course the action depending on the result of the
response.

//Code for constructing the abMsgBox by a button:

public void OnActionbutton1 (Object arg)
{
abMsgBox mymsgbox = new abMsgBox("Answer?","Test",this , abConst.YES , this);
mymsgbox.show();
return;
}

//Code for using the update method to write the received answer into a //textfield:

public boolean update (Object src, Object arg)
{
int received = ((abHint)arg).reason;
String answer = "NO ANSWER";
if ( received == abConst.YES) answer = "YES";
if ( received == abConst.CANCEL) answer = "CANCEL";
try { textField1.setDisplayValue(answer);}
catch (Exception e) {e.printStackTrace();}

return true;
}

References To Written Documentation:

Apptivity API Reference