Recent Changes - Search:

OtherPlaces

PmWiki

pmwiki.org

edit SideBar

GUIIdeas

In this code MyGUI>>open generates the layout for the GUI. These tend to be long methods, because there is so much detail in them. In an effort to reduce the size of 'open', I segregated several similar bits under the method name of 'row<description>:' (rowCurrentTemp:, rowPrefTemp:, etc). Each of the methods are inserted into 'open'.

In open, you see:

	dialog newColumn: {
		self rowPrefTemp: dialog.
		self rowHeaterAdjustment: dialog.
		self rowCoolerAdjustment: dialog.
		self rowFudgeAdjustment: dialog.
		self rowBumpTemp: dialog.
		self rowTurnOnMargin: dialog.
		self rowTurnOffMargin: dialog.
		self rowDelaySeconds: dialog.
		self rowCurrentTemp: dialog.
	}.

One of these, for example rowPrefTemp:

rowPrefTemp: dialog

    ^dialog newRow: {
      prefTemp := dialog newTextEntryFor: (ValueHolder new contents: myControl
      therm prefTemp)
              getText: #contents setText: #contents: help: 'This is the pref temp'.
      dialog 
        newButtonFor: self
        getState: nil
        action: #setPrefTemp
        arguments: nil "if args, use { xx. xxx.}"
        getEnabled: nil 
        label: '   Set Preferred'
        help: 'helpText'.
    }.

Note how each method takes 'dialog' as an argument. dialog is used internally in the methods.

It appears that these methods must specifically 'return' (using the carat '^' symbol). Otherwise the method will be performed, but there is no automatic return of the output. I am not sure why the ^ is necessary.

What's nice about this, besides making 'open' more readable, is that the order of the buttons can be easily changed.

Edit - History - Print - Recent Changes - Search
Page last modified on May 01, 2011, at 10:41 AM