/* QSort Sample 0.1, a sample QuickFigure Tool Copyright 1994-1995 PelicanWare, Inc. Written By Don A. Vollum */ constant kAppName := "QSort Sample 0.1"; constant kAppSym := '|qsort01:donv|; constant kToolRegistry := '|qfTools:qfig:donv|; partData := {}; partData.ToolInfo := {name: kAppName, path: kAppSym}; installScript := func(partFrame,removeFrame) begin //move it into the removeFrame so that we can use it in the removeScript: removeFrame.(ensureInternal('toolInfo)) := ensureInternal(partFrame.PartData.ToolInfo); /* get the reference to the layout, and add it to the root (using buildContext to turn it into a view): */ getRoot().(ensureInternal(kAppSym)) := buildContext(partframe.partData.mainView); //add the tool reference to the tool array, first making sure that the tool array is there: if not getRoot().(kToolRegistry) then getRoot().(ensureInternal(kToolRegistry)) := totalClone([]); addArraySlot(getRoot().(kToolRegistry),removeFrame.toolInfo); end; removeScript := func(removeFrame) begin //get rid of the reference in the tool array: if hasSlot(getRoot(),kToolRegistry) then begin setRemove(getRoot().|qfTools:qfig:donv|,removeFrame.toolInfo); end; //get rid of the reference in the root: if hasSlot(getRoot(),kAppSym) then removeSlot(getRoot(),kAppSym); end; // ---- End Project Data ---- // ---- File QSort Main ---- QSortMain := {viewBounds: {left: -4, top: 62, right: 184, bottom: 130}, ddxFrom: nil, ddxScript: func(numRows,numCols,cellArray,dummy) begin //store the data in the base view: data := cellArray; nr := numRows; nc := numCols; //open the Tool's main view: getRoot().(kAppSym):open(); end, data: nil, sortTestSymbols: ['|<|,'|str<|,'|>|,'|str>|], currSortSymbol: nil, nr: nil, nc: nil, _proto: protoFloatNGo, debug: "QSortMain" }; _view000 := /* child of QSortMain */ {title: "QSort 0.1", viewBounds: {left: 0, top: 0, right: 56, bottom: 16}, _proto: protoTitle }; _view001 := /* child of QSortMain */ {text: "Sort", buttonClickScript: func() begin //do the sort: if not currSortSymbol then currSortSymbol := sortTestSymbols[0]; sort(data,currSortSymbol,nil); //convert the data to strings: local newData := []; forEach element in Data do addArraySlot(newData,SPrintObject(element)); //return the data to QuickFigure: getRoot().(ddxFrom):ddxScript(nr,nc,newData); //get out of the way: self:parent():close(); end, viewBounds: {left: 0, top: 50, right: 50, bottom: 62}, viewJustify: 8388630, _proto: protoTextButton }; _view002 := /* child of QSortMain */ {viewBounds: {left: 1, top: 25, right: 199, bottom: 39}, labelCommands: ["Ascending Numerical","Ascending String","Descending Numerical","Descending String"] , text: "Sort By:", labelActionScript: func(cmd) begin currSortSymbol := sortTestSymbols[cmd]; end, _proto: protoLabelPicker }; // After Script for "QSortMain" thisView := QSortMain; //places a reference to the layout in the partData.mainView slot: partData.mainView := thisView; // ---- Beginning of section for non used Layout files ---- // End of output