Page 1 of 1

PostPosted: Fri Jun 02, 2006 12:54 am
by FrankG
I ran into an error in a program in a part of the code that has worked for a long time. I suspect I had updated the program and recompiled with OrbForms 4.0.1 and the new PRC suddenly had this problem:

I got a "butIOK.onselect butIOK not in current form" type error in this handler in a modal form. Code was:
Code: Select all
handler butIOK.onselect() {
  if (LstIGame.selitem >= 0) {
    if (pbIh.checked) {
      if (ReadRoster(true)) {
        frmImport.close();
      } 
    } 
    if (pbIv.checked) {
      if (ReadRoster(false)) {
        frmImport.close();
      } 
    }
  }
  else
    alert("Before importing blah blah blah.");
}

and I changed it to
Code: Select all
handler butIOK.onselect() {
  if (LstIGame.selitem >= 0) {
    if (pbIh.checked) {
      if (ReadRoster(true)) {
        frmImport.close();
      } 
    } 
    else {
      if (pbIv.checked) {
        if (ReadRoster(false)) {
          frmImport.close();
        } 
      }
    } 
  }
  else
    alert("Before importing blah blah blah.");
}

and now it works. I think once there was a similar problem I encountered with IF nesting with unnecessary braces (?)

Anyhow, FYI.

Frank

PostPosted: Fri Jun 23, 2006 2:28 am
by dewey
This isn't a compiler issue, it is a runtime issue. If the first condition succeeds, you close the form. When you go to evaluate the second "if (pbIv.checked)", the form is already closed, so pbIv is no longer in the current form.

PostPosted: Fri Jun 23, 2006 1:24 pm
by FrankG
> This isn't a compiler issue, it is a runtime issue.

Dewey,

I guess I have to disagree. I don't think it's a runtime issue it's a programmer issue: Me. Duh -- sorry about that; I should have seen that!

Thank you,
Frank