Pick location and WxeGen.exe

The best way to understand what wxegen.exe generates is to look how a re-call function is used first.

Page Calling _Pick location_ introduces the transition from the calling EditPersonForm (Arnold Schwarzenegger) to the called PickLocation form. As a programmer, you express the transition in the event handler for the Pick location menu item:

  1. the event handler for the reference property menu with New location... and Pick location...
  2. the case handler for Pick location menu item – that's what we want
  3. the Person's (Arnold's) Location property receives the picked Location
  4. the PickLocation form is called – that's where the rubber meets the road

The Method is a static method all classes for re-call functions have. The code for such these methods is peculiar for the class, but its concrete manifestation is very boring and pure boilerplate. wxegen.exe generates the code for Call – or two Call methods, actually. These methods support re-throwing exceptions across postbacks and the page functions' call stack. You can have a look at PickLocation's Call-s methods here: PickLocation's Call methods.

re-call variables and wxegen.exe

wxegen.exe not also generates the Call method, but also properties for accessing page-local variables – including the return value and parameters. This data is stored in an untyped Dictionary, but wxegen.exe takes care of appropriate casts. Remember from the Pick location's re-call header page that we have specified

  • the return value of the page function is Location – a Location object is passed back to the caller, after all
  • a local variable named items of type Location[] – this array of locations is required for storing the pick-list ("3" in the illustration above) between post-backs

This is what wxegen.exe makes from this:

        
        public Location ReturnValue {
            set {
                this.Variables["ReturnValue"] = value;
            }
        }
        
        public Location[] items {
            get {
                return ((Location[])(this.Variables["items"]));
            }
            set {
                this.Variables["items"] = value;
            }
        }