next up previous contents
Next: When will the functions be invoked Up: The InitChange, ShowPage and PageEnd Previous: Interpage dependencies

Example of the ShowPage function

  To illustrate interpage dependencies, here comes an example. In this example a program exists, which has two different versions, that only differs a bit. The module programmer has decided that he will configure both versions with the same module. On a page called Version the user can select which version he uses with a radio button. This may look like this:

proc version {} {
  # version
  Radio ver -text "version of the program" -entries {6 6.01}
}

No ShowPage, Change, Init, PageEnd or Save functions is necceary on this page, as it doesn't generate any code, and the radio element is always enabled.

On a different page an element exist, say a CheckBox with label Use feature 42. This option is only avilable in version 6.01 of the program, and should therefore be disabled, when version 6 is selected. No code should be generated for this option if version 6 is selected.

This page may look like this:

proc page {} {
  # page
  CheckBox feature -text "feature 42"
  
  ShowPage {
    if {[set version@ver(name)] == "6.01"} {
      Disable feature
    } else {
      Enable feature
    }
  }

  Save {
    if {[set version@ver(name)] != "6.01"} {
      print "use feature42: $feature"
    }
  }
}

As you can see, no Change function exists, since there is no intrapage dependencies.



Jesper Kjær Pedersen <blackie@imada.ou.dk>
Wed Oct 2 13:29:53 MET DST 1996