Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2010 00:45
Show Gist options
  • Select an option

  • Save anonymous/479124 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/479124 to your computer and use it in GitHub Desktop.
// ==========================================================================
// Project: PopupTest1 - mainPage
// Copyright: ©2010 My Company, Inc.
// ==========================================================================
/*globals PopupTest1 */
/**
* This is resources/main_page.js for a fresh sc-gen app PopupTest1
*
* Switching the order of popupButton and defaulButton in the childViews
* causes defaultButton to work or not work when return is presed in the input box
*
*/
PopupTest1.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'textInput popupButton defaultButton resultView'.w(),
//childViews: 'textInput defaultButton popupButton resultView'.w(),
textInput: SC.TextFieldView.design({
layout: { centerX: -200, centerY: 0, width: 260, height: 24 },
hint: "Type something here and hit enter",
}),
defaultButton: SC.ButtonView.design({
layout: { centerX: 0, centerY: 0, width: 80, height: 24 },
title: "Default",
isDefault: YES,
action: function() {
var pane = this.get('pane');
pane.get('resultView').set('value', 'Clicked value: '+pane.get('textInput').get('fieldValue'));
}
}),
popupButton: SC.PopupButtonView.design({
layout: { centerX: 100, centerY: 0, width: 80, height: 24 },
title: "Popup",
menuBinding: "PopupTest1.mainPage.menuPane"
}),
resultView: SC.LabelView.design({
layout: { centerX: 0, centerY: 40, width: 250, height: 24 },
})
}),
menuPane: SC.MenuPane.design({
layout: { width: 200 },
items: "item1 item2 item3".w()
}),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment