// Copyright © 1993-94 Apple Computer, Inc. All rights reserved. constant kAppSymbol := '|Table:PIEDTS|; // ---- End Project Data ---- // ---- File protoTable.t ---- tableApp := {title: "protoTable example", viewBounds: {top: 0, left: 0, right: 240, bottom: 336}, viewScrollUpScript: func() begin theTable:viewScrollUpScript(); end, viewScrollDownScript: func() begin theTable:viewScrollDownScript(); end, viewSetupFormScript: func() begin local a := GetAppParams(); self.viewBounds := RelBounds(a.appAreaLeft, a.appAreaTop, a.appAreaWidth, a.appAreaHeight); end, _proto: protoApp, debug: "tableApp" }; theTable := /* child of tableApp */ {def: protoTableDef, viewSetupFormScript: func() begin // clone the table definition first to avoid read only errors def := Clone(def); def.tabProtos := protoTableEntry; // protoTableEntry // For full-width text, the tabWidths MUST fit inside the table or nothing will appear, // so this calculation accomplishes that. It's bogus and redundant and you should, if at // all possible, precalculate and put in a constant here. The 2 at the end leaves space // for the table border on either side. (Sigh) def.tabWidths := viewBounds.right - viewBounds.left - 2 ; def.tabDown := 10; def.tabValueSlot := 'text; def.tabValues := ["foo", "bar", "baz", "qux", "4", "5", "6", "7", "8", "9"]; end, viewBounds: {left: 10, top: 26, right: 201, bottom: 104}, scrollAmount: 1, currentSelection: nil, selectThisCell: func(which) begin // skanky hack to get informed when cells are selected // make sure to call the inherited function, otherwise things // do not get updated properly! inherited:selectThisCell(which); // currentSelection contains the item from the table // definition tabValues array that is selected.... // so use that to set the text slot of theText SetValue(theText, 'text, currentSelection); end, debug: "theTable", viewScrollDownScript: func() begin local biggestTop; local temp := ((viewBounds.bottom - viewBounds.top) / def.tabHeights); temp := if (temp - Floor(temp)) < 0.5 then Floor(temp) else Floor(temp) + 1 ; // biggestTop is the cell index of the topmost cell when // the table is maximally scrolled biggestTop := Max(0, def.tabDown - temp) ; if vOrg < biggestTop then begin vOrg := vOrg + scrollAmount; if vOrg > biggestTop then vOrg := biggestTop ; tabbase:RedoChildren(); :updateSelection(); end; end, _proto: protoTable }; // View theTable is declared to tableApp _view000 := /* child of tableApp */ {text: "You Picked:", viewBounds: {left: 10, top: 114, right: 74, bottom: 138}, _proto: protoStaticText }; theText := /* child of tableApp */ {text: "", viewBounds: {left: 74, top: 114, right: 162, bottom: 130}, _proto: protoStaticText, debug: "theText" }; // View theText is declared to tableApp _view001 := /* child of tableApp */ {viewBounds: {left: 206, top: 41, right: 225, bottom: 64}, viewFormat: 1, buttonPressedScript: func() begin theTable:viewScrollUpScript(); theTable:Dirty(); RefreshViews(); end, _proto: protoPictureButton }; // After Script for "_view001" thisView := _view001; begin // skanky hack to get ROM version of up arrow into // the icon slot. // see the Documentation (interrim or otherwise) // for further explantion of afterScript and beforeScript thisView.icon := ROM_uparrowbitmap ; end _view002 := /* child of tableApp */ {viewBounds: {left: 206, top: 68, right: 225, bottom: 88}, viewFormat: 1, buttonPressedScript: func() begin theTable:viewScrollDownScript() ; theTable:Dirty(); RefreshViews(); end, _proto: protoPictureButton }; // After Script for "_view002" thisView := _view002; begin // skanky hack to get ROM version of up arrow into // the icon slot. // see the Documentation (interrim or otherwise) // for further explantion of afterScript and beforeScript thisView.icon := ROM_downarrowbitmap ; end // ---- Beginning of section for non used Layout files ---- // End of output