Friday, August 31, 2007

Overriding method for a control in dialog (RunBase framework)

Scenario:
Can we have an overridden method in a dialog class. I can not use form as a dialog. I have to add a method in the dialog class. Like modified method of an EDT.

Answer:
Well it can be done. First you have to add a method dialogPostRun

public void dialogPostRun(DialogRunbase dialog)
{
;
dialog.dialogForm().formRun().controlMethodOverload(true);
dialog.dialogForm().formRun().controlMethodOverloadObject(this);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
super(dialog);
}

This method actually allows the dialog form to override control method at runtime. Now we need the name of the control at runtine that needs the overriden method. You can get that using

print dialogCustId.name();
pause;

where dialogCustId is the EDT. let say the name returned at runtime is Fld3_1.


Now if you have to override lookup method of the EDT you can write the method like this

void Fld3_1_lookup()
{
//override lookup method here
}

If you need to override modified method

boolean Fld3_1_modified()
{
}

.
The modified method can also be accessed by overriding

public void dialogSelectCtrl()
{
}

in the runbase class. Just call

dialog.allowUpdateOnSelectCtrl(true);

in the dialog method.

You can also create a dialog form and pass it as the parameter in the dialog method of runbase class. you can find an example in tutorial_runbase class and form.

8 comments:

  1. Can these methods be implemented in a Report. I tried to use DialogSelectCtrl ,for changing the value of DialogFieldA based on the value selected in DialogFieldB.This works ,however only after a mouse click. I want the values in DialogFieldA to change as soon as the Value in DialogFieldB is changed. Is there a solution for this ? I need to implement this in a report dialog.

    ReplyDelete
  2. I am also trying to achieve this in a Report. Is it possible?

    ReplyDelete
  3. Gals
    You have got to see this. Obama playing on XBox. Funniest video ever. http://bit.ly/bllhx1

    ReplyDelete
  4. Hello. My wife and I bought our house about 6 months ago. It was a foreclosure and we were able to get a great deal on it. We also took advantage of the 8K tax credit so that definitely helped. We did an extensive remodeling job and now I want to refinance to cut the term to a 20 or 15 year loan. Does anyone know any good sites for mortgage information? Thanks!

    Mike

    ReplyDelete
  5. I'd also like to do this for a report if it's possible.

    ReplyDelete
  6. perfect explanation about java programming .its very useful.thanks for your valuable information.java training in chennai | java training in velachery

    ReplyDelete