ChangeForm: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Line 5: Line 5:
ChangeForm hides the current form and shows ''newForm''. When the current form is hidden, its onhide() function is called. When the new form shows, its onshow() function is called. The global variable [[NSBCurrentForm]] is set to ''newForm''.
ChangeForm hides the current form and shows ''newForm''. When the current form is hidden, its onhide() function is called. When the new form shows, its onshow() function is called. The global variable [[NSBCurrentForm]] is set to ''newForm''.


== Example ==
== Example (Basic) ==


<pre>
<pre>
Line 20: Line 20:
   Msgbox "Show form " & NSBCurrentForm.id
   Msgbox "Show form " & NSBCurrentForm.id
End Function
End Function
</pre>
== Example (JavaScript) ==
<pre>
//ChangeForm sample call
ChangeForm(Form2);
//go to next form without transition
Form1.onhide = function() {
  savethefunction_rvar="";
  _msgbox_confirm("Old Form Hidden");
  return savethefunction_rvar;
}
Form2.onshow = function() {
  savethefunction_rvar="";
  _msgbox_confirm("Show form "  +  NSBCurrentForm.id);
  return savethefunction_rvar;
}
</pre>
</pre>



Revision as of 05:50, 1 May 2013

ChangeForm(newForm)

Description

ChangeForm hides the current form and shows newForm. When the current form is hidden, its onhide() function is called. When the new form shows, its onshow() function is called. The global variable NSBCurrentForm is set to newForm.

Example (Basic)

Rem ChangeForm sample call

ChangeForm(Form2)             
'go to next form without transition

Function Form1_onhide()
  MsgBox "Old Form Hidden"
End Function

Function Form2_onshow()
  Msgbox "Show form " & NSBCurrentForm.id
End Function

Example (JavaScript)

//ChangeForm sample call

ChangeForm(Form2);
//go to next form without transition

Form1.onhide = function() {
  savethefunction_rvar="";
  _msgbox_confirm("Old Form Hidden");
  return savethefunction_rvar;
}

Form2.onshow = function() {
  savethefunction_rvar="";
  _msgbox_confirm("Show form "  +  NSBCurrentForm.id);
  return savethefunction_rvar;
}

Output

(msgbox showing "Old Form Hidden")

(msgbox showing "Show form Form2")

Related Items

Form