Hi All,
I'm looking at a bug with the Win64 FFI when there are more than four
arguments. The test functions are
in platforms/Cross/plugins/SqueakFFIPrims/sqFFITestFuncs.c and the SUnit
code is in FFI-Tests, e.g. on http://source.squeak.org/FFI. But
whereas sqFFITestFuncs.c already contains functions such as ffiTestInts8,
ffiTestFloats7, ffiTestFloats13, there are no test for these in FFI-Tests.
Can anyone point me to such tests, and/or commit them to FFI-Tests on
http://source.squeak.org/FFI?
AdvThanksance
_,,,^..^,,,_
best, Eliot
Patrick Rein uploaded a new version of 60Deprecated to project The Trunk:
http://source.squeak.org/trunk/60Deprecated-pre.26.mcz
==================== Summary ====================
Name: 60Deprecated-pre.26
Author: pre
Time: 1 November 2018, 4:37:00.842943 pm
UUID: bc6bf5b8-7506-1646-8916-4a77bfe9101e
Ancestors: 60Deprecated-pre.25
Moves deprecated methods from 53Deprecated to 60Deprecated:
Deprecates two drag and drop menu methods. One broke with the naming convention for menu item selectors and the other is unnecessary as the superclass already implements the same behavior.
Deprecates two DummyUIManager methods which are not provided anymore by UIManagers
=============== Diff against 60Deprecated-pre.25 ===============
Item was added:
+ ----- Method: DummyUIManager>>fontFromUser: (in category '*60Deprecated') -----
+ fontFromUser: priorFont
+ self error: 'No user response possible'!
Item was added:
+ ----- Method: DummyUIManager>>openPluggableFileListLabel:in: (in category '*60Deprecated') -----
+ openPluggableFileListLabel: aString in: aWorld
+ "PluggableFileList is being deprecated and this can go away soon"
+ "This method is not used anymore in 5.2 by any system classes and seems to have been
+ renamed to openPluggableFileList:label:in:"
+ ^nil!
Item was added:
+ ----- Method: Morph>>toggleDragNDrop (in category '*60Deprecated-dropping/grabbing') -----
+ toggleDragNDrop
+ "Toggle this morph's ability to add and remove morphs via drag-n-drop."
+
+ self enableDragNDrop: self dragNDropEnabled not.
+ !
Item was added:
+ ----- Method: PasteUpMorph>>isOpenForDragNDropString (in category '*60Deprecated-menu & halo') -----
+ isOpenForDragNDropString
+ "Answer the string to be shown in a menu to represent the
+ open-to-drag-n-drop status"
+ ^ (self dragNDropEnabled
+ ifTrue: ['<on>']
+ ifFalse: ['<off>'])
+ , 'open to drag & drop' translated!
Patrick Rein uploaded a new version of 53Deprecated to project The Trunk:
http://source.squeak.org/trunk/53Deprecated-pre.2.mcz
==================== Summary ====================
Name: 53Deprecated-pre.2
Author: pre
Time: 1 November 2018, 3:49:25.914943 pm
UUID: 67b0129c-faea-074b-9be1-bea4e0e444c2
Ancestors: 53Deprecated-pre.1
Deprecates two drag and drop menu methods. One broke with the naming convention for menu item selectors and the other is unnecessary as the superclass already implements the same behavior.
=============== Diff against 53Deprecated-pre.1 ===============
Item was added:
+ ----- Method: Morph>>toggleDragNDrop (in category '*53Deprecated-dropping/grabbing') -----
+ toggleDragNDrop
+ "Toggle this morph's ability to add and remove morphs via drag-n-drop."
+
+ self enableDragNDrop: self dragNDropEnabled not.
+ !
Item was added:
+ ----- Method: PasteUpMorph>>isOpenForDragNDropString (in category '*53Deprecated-menu & halo') -----
+ isOpenForDragNDropString
+ "Answer the string to be shown in a menu to represent the
+ open-to-drag-n-drop status"
+ ^ (self dragNDropEnabled
+ ifTrue: ['<on>']
+ ifFalse: ['<off>'])
+ , 'open to drag & drop' translated!
Patrick Rein uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-pre.338.mcz
==================== Summary ====================
Name: EToys-pre.338
Author: pre
Time: 1 November 2018, 3:51:24.160943 pm
UUID: 6f79ee91-3e92-be4e-9d20-265de9c14a1f
Ancestors: EToys-dtl.337
Migrates methods to use the menu method selector which sticks to the existing selector pattern
=============== Diff against EToys-dtl.337 ===============
Item was changed:
----- Method: PasteUpMorph>>presentViewMenu (in category '*Etoys-viewing') -----
presentViewMenu
"Answer an auxiliary menu with options specific to viewing playfields -- this is put up from the provisional 'view' halo handle, on pasteup morphs only."
| aMenu isWorld |
isWorld := self isWorldMorph.
aMenu := MenuMorph new defaultTarget: self.
aMenu addStayUpItem.
self addViewingItemsTo: aMenu.
#( "(autoLineLayoutString toggleAutoLineLayout
'whether submorphs should automatically be laid out in lines')"
(indicateCursorString toggleIndicateCursor
'whether the "current" submorph should be indicated with a dark black border')
(resizeToFitString toggleResizeToFit
'whether I should automatically strive exactly to fit my contents')
(behaveLikeAHolderString toggleBehaveLikeAHolder
'whether auto-line-layout, resize-to-fit, and indicate-cursor should be set to true; useful for animation control, etc.')
(isPartsBinString toggleIsPartsBin
'whether dragging an object from the interior should produce a COPY of the object')
+ (hasDragAndDropEnabledString changeDragAndDrop
- (isOpenForDragNDropString toggleDragNDrop
'whether objects can be dropped into and dragged out of me')
(mouseOverHalosString toggleMouseOverHalos
'whether objects should put up halos when the mouse is over them')
(autoExpansionString toggleAutomaticPhraseExpansion
'whether tile phrases, dropped on me, should automatically sprout Scriptors around them')
(originAtCenterString toggleOriginAtCenter
'whether the cartesian origin of the playfield should be at its lower-left corner or at the center of the playfield')
(showThumbnailString toggleAlwaysShowThumbnail
'whether large objects should be represented by thumbnail miniatures of themselves')
(fenceEnabledString toggleFenceEnabled
'whether moving objects should stop at the edge of their container')
(autoViewingString toggleAutomaticViewing
'governs whether, when an object is touched inside me, a viewer should automatically be launched for it.')
(griddingString griddingOnOff
'whether gridding should be used in my interior')
(gridVisibleString gridVisibleOnOff
'whether the grid should be shown when gridding is on')
) do:
[:triplet |
(isWorld and: [#(toggleAutoLineLayout toggleIndicateCursor toggleIsPartsBin toggleAlwaysShowThumbnail toggleAutomaticViewing ) includes: triplet second]) ifFalse:
[aMenu addUpdating: triplet first action: triplet second.
aMenu balloonTextForLastItem: triplet third translated]].
aMenu addLine.
aMenu add: 'round up strays' translated action: #roundUpStrays.
aMenu balloonTextForLastItem: 'Bring back all objects whose current coordinates keep them from being visible, so that at least a portion of each of my interior objects can be seen.' translated.
aMenu add: 'gallery of players' translated target: self action: #galleryOfPlayers.
aMenu balloonTextForLastItem: 'A tool that lets you find out about all the players used in this project' translated.
aMenu add: 'shuffle contents' translated action: #shuffleSubmorphs.
aMenu balloonTextForLastItem: 'Rearranges my contents in random order' translated.
aMenu add: 'set grid spacing...' translated action: #setGridSpec.
aMenu balloonTextForLastItem: 'Set the spacing to be used when gridding is on' translated.
isWorld ifFalse:
[aMenu add: 'set thumbnail height...' translated action: #setThumbnailHeight.
aMenu balloonTextForLastItem: 'if currently showing thumbnails governs the standard height for them' translated].
self backgroundSketch ifNotNil:
[aMenu add: 'delete background painting' translated action: #deleteBackgroundPainting.
aMenu balloonTextForLastItem: 'delete the graphic that forms the background for this me.' translated].
aMenu addLine.
self addPenTrailsMenuItemsTo: aMenu.
aMenu addLine.
aMenu add: 'use standard texture' translated action: #setStandardTexture.
aMenu balloonTextForLastItem: 'use a pale yellow-and-blue background texture here.' translated.
aMenu add: 'make graph paper...' translated action: #makeGraphPaper.
aMenu balloonTextForLastItem: 'Design your own graph paper and use it as the background texture here.' translated.
aMenu addTitle: ('viewing options for "{1}"' translated format: {self externalName}).
aMenu popUpForHand: self activeHand in: self world
!
Item was changed:
----- Method: StackMorph>>offerBookishMenu (in category 'menu') -----
offerBookishMenu
"Offer a menu with book-related items in it"
| aMenu |
aMenu := MenuMorph new defaultTarget: self.
aMenu addTitle: 'Stack / Book' translated.
aMenu addStayUpItem.
aMenu addList:
#(('sort pages' sortPages)
('uncache page sorter' uncachePageSorter)).
(self hasProperty: #dontWrapAtEnd)
ifTrue: [aMenu add: 'wrap after last page' translated selector: #setWrapPages: argument: true]
ifFalse: [aMenu add: 'stop at last page' translated selector: #setWrapPages: argument: false].
aMenu addList:
#(('make bookmark' bookmarkForThisPage)
('make thumbnail' thumbnailForThisPage)).
aMenu addLine.
aMenu add: 'sound effect for all pages' translated action: #menuPageSoundForAll:.
aMenu add: 'sound effect this page only' translated action: #menuPageSoundForThisPage:.
aMenu add: 'visual effect for all pages' translated action: #menuPageVisualForAll:.
aMenu add: 'visual effect this page only' translated action: #menuPageVisualForThisPage:.
aMenu addLine.
(self primaryHand pasteBuffer class isKindOf: PasteUpMorph class) ifTrue:
[aMenu add: 'paste book page' translated action: #pasteBookPage].
aMenu add: 'save as new-page prototype' translated action: #setNewPagePrototype.
newPagePrototype ifNotNil: [
aMenu add: 'clear new-page prototype' translated action: #clearNewPagePrototype].
aMenu add: (self dragNDropEnabled ifTrue: ['close' translated ] ifFalse: ['open' translated]) , ' dragNdrop' translated
+ action: #changeDragAndDrop.
- action: #toggleDragNDrop.
aMenu addLine.
aMenu add: 'make all pages this size' translated action: #makeUniformPageSize.
aMenu addUpdating: #keepingUniformPageSizeString target: self action: #toggleMaintainUniformPageSize.
aMenu addLine.
aMenu add: 'send all pages to server' translated action: #savePagesOnURL.
aMenu add: 'send this page to server' translated action: #saveOneOnURL.
aMenu add: 'reload all from server' translated action: #reload.
aMenu add: 'copy page url to clipboard' translated action: #copyUrl.
aMenu add: 'keep in one file' translated action: #keepTogether.
aMenu addLine.
aMenu add: 'load PPT images from slide #1' translated action: #loadImagesIntoBook.
aMenu add: 'background color for all pages...' translated action: #setPageColor.
aMenu popUpEvent: self world activeHand lastEvent in: self world
!
Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1466.mcz
==================== Summary ====================
Name: Morphic-pre.1466
Author: pre
Time: 1 November 2018, 3:44:22.135943 pm
UUID: f54ada99-f6e1-ec41-a031-857090cecacb
Ancestors: Morphic-pre.1465
Changes the drag and drop menu boxes to reflect the migration started long ago from one drag and drop setting to two settings, one for drag and one for drop. Solves the DockingBar context menu confusion.
=============== Diff against Morphic-pre.1465 ===============
Item was changed:
----- Method: Morph>>addToggleItemsToHaloMenu: (in category 'menus') -----
addToggleItemsToHaloMenu: aMenu
"Add standard true/false-checkbox items to the memu"
#(
(resistsRemovalString toggleResistsRemoval 'whether I should be reistant to easy deletion via the pink X handle' true)
(stickinessString toggleStickiness 'whether I should be resistant to a drag done by mousing down on me' true)
(lockedString lockUnlockMorph 'when "locked", I am inert to all user interactions' true)
(hasClipSubmorphsString changeClipSubmorphs 'whether the parts of objects within me that are outside my bounds should be masked.' false)
(hasDirectionHandlesString changeDirectionHandles 'whether direction handles are shown with the halo' false)
+ (hasDragEnabledString changeDrag 'whether I am open to having objects dragged out of me' false)
+ (hasDropEnabledString changeDrop 'whether I am open to having objects dropped into me' false)
- (hasDragAndDropEnabledString changeDragAndDrop 'whether I am open to having objects dropped into me' false)
)
select:[:each | Preferences noviceMode not or:[each fourth]]
thenDo:
[:each |
aMenu addUpdating: each first action: each second.
aMenu balloonTextForLastItem: each third translated].
self couldHaveRoundedCorners ifTrue:
[aMenu addUpdating: #roundedCornersString action: #toggleCornerRounding.
aMenu balloonTextForLastItem: 'whether my corners should be rounded' translated]!
Item was added:
+ ----- Method: Morph>>changeDrag (in category 'menus') -----
+ changeDrag
+ ^ self enableDrag: self dragEnabled not!
Item was changed:
----- Method: Morph>>changeDragAndDrop (in category 'menus') -----
changeDragAndDrop
+ ^ self enableDragNDrop: self dragNDropEnabled not!
- ^self enableDragNDrop: self dragNDropEnabled not!
Item was added:
+ ----- Method: Morph>>changeDrop (in category 'menus') -----
+ changeDrop
+ ^ self enableDrop: self dropEnabled not!
Item was changed:
----- Method: Morph>>hasDragAndDropEnabledString (in category 'menus') -----
hasDragAndDropEnabledString
"Answer a string to characterize the drag & drop status of the
receiver"
^ (self dragNDropEnabled
ifTrue: ['<on>']
ifFalse: ['<off>'])
+ , 'drag and drop enabled' translated!
- , 'accept drops' translated!
Item was added:
+ ----- Method: Morph>>hasDragEnabledString (in category 'menus') -----
+ hasDragEnabledString
+
+ ^ (self dragEnabled
+ ifTrue: ['<on>']
+ ifFalse: ['<off>'])
+ , 'drag out' translated!
Item was added:
+ ----- Method: Morph>>hasDropEnabledString (in category 'menus') -----
+ hasDropEnabledString
+
+ ^ (self dropEnabled
+ ifTrue: ['<on>']
+ ifFalse: ['<off>'])
+ , 'drop in' translated!
Item was removed:
- ----- Method: Morph>>toggleDragNDrop (in category 'dropping/grabbing') -----
- toggleDragNDrop
- "Toggle this morph's ability to add and remove morphs via drag-n-drop."
-
- self enableDragNDrop: self dragNDropEnabled not.
- !
Item was removed:
- ----- Method: PasteUpMorph>>isOpenForDragNDropString (in category 'menu & halo') -----
- isOpenForDragNDropString
- "Answer the string to be shown in a menu to represent the
- open-to-drag-n-drop status"
- ^ (self dragNDropEnabled
- ifTrue: ['<on>']
- ifFalse: ['<off>'])
- , 'open to drag & drop' translated!
Patrick Rein uploaded a new version of 53Deprecated to project The Trunk:
http://source.squeak.org/trunk/53Deprecated-pre.1.mcz
==================== Summary ====================
Name: 53Deprecated-pre.1
Author: pre
Time: 1 November 2018, 3:32:44.901943 pm
UUID: 6d82be7f-8d20-1b45-8fcc-9f309737aef1
Ancestors:
Deprecates two DummyUIManager methods which are not provided anymore by UIManagers
==================== Snapshot ====================
----- Method: DummyUIManager>>fontFromUser: (in category '*53Deprecated') -----
fontFromUser: priorFont
self error: 'No user response possible'!
----- Method: DummyUIManager>>openPluggableFileListLabel:in: (in category '*53Deprecated') -----
openPluggableFileListLabel: aString in: aWorld
"PluggableFileList is being deprecated and this can go away soon"
"This method is not used anymore in 5.2 by any system classes and seems to have been
renamed to openPluggableFileList:label:in:"
^nil!
Patrick Rein uploaded a new version of CommandLine to project The Trunk:
http://source.squeak.org/trunk/CommandLine-pre.11.mcz
==================== Summary ====================
Name: CommandLine-pre.11
Author: pre
Time: 1 November 2018, 2:57:18.793173 pm
UUID: 578497bd-0e64-a84f-8df7-d2e096d406ec
Ancestors: CommandLine-tpr.10
Updates the DummyUIManager to answer the ProvideAnswerNotification
=============== Diff against CommandLine-tpr.10 ===============
Item was changed:
----- Method: DummyUIManager>>chooseDirectory:from: (in category 'ui requests') -----
chooseDirectory: label from: dir
+ self askForProvidedAnswerTo: label ifSupplied: [:answer |
+ ^ answer].
+
^ nil!
Item was changed:
----- Method: DummyUIManager>>chooseFrom:lines:title: (in category 'ui requests') -----
chooseFrom: aList lines: linesArray title: aString
+ self askForProvidedAnswerTo: aString ifSupplied: [:answer |
+ (answer = #cancel or: [answer isNil]) ifTrue: [^ 0].
+ ^ aList indexOf: answer].
+
+ ^ 1!
- ^ aList first!
Item was changed:
----- Method: DummyUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----
chooseFrom: labelList values: valueList lines: linesArray title: aString
+ self askForProvidedAnswerTo: aString ifSupplied: [:answer |
+ (answer = #cancel or: [answer isNil]) ifTrue: [^ nil].
+ ^ valueList at: (valueList indexOf: answer)].
+
^ valueList first!
Item was changed:
----- Method: DummyUIManager>>confirm: (in category 'ui requests') -----
confirm: queryString
+ self askForProvidedAnswerTo: queryString ifSupplied: [:answer |
+ ^ answer].
- (ProvideAnswerNotification signal: queryString)
- ifNotNil: [:answer|^answer].
self error: 'No user response possible'!
Item was changed:
----- Method: DummyUIManager>>confirm:orCancel: (in category 'ui requests') -----
confirm: aString orCancel: cancelBlock
+ self askForProvidedAnswerTo: aString ifSupplied: [:answer |
+ ^ (answer = #cancel or: [answer isNil])
+ ifTrue: [cancelBlock value]
+ ifFalse: [answer]].
- (ProvideAnswerNotification signal: aString) ifNotNil: [:answer |
- ^answer == #cancel ifTrue: [cancelBlock value] ifFalse: [answer]].
self error: 'No user response possible'!
Item was removed:
- ----- Method: DummyUIManager>>fontFromUser: (in category 'ui requests') -----
- fontFromUser: priorFont
- self error: 'No user response possible'!
Item was changed:
----- Method: DummyUIManager>>inform: (in category 'ui requests') -----
inform: aString
+ "Nothing to be done here"
+ self askForProvidedAnswerTo: aString ifSupplied: [:answer |
+ ^ answer].!
- "Nothing to be done here"!
Item was changed:
+ ----- Method: DummyUIManager>>openDebugger:on:context:label:contents:fullView: (in category 'ui project indirecting') -----
- ----- Method: DummyUIManager>>openDebugger:on:context:label:contents:fullView: (in category 'ui requests') -----
openDebugger: aDebugger on: process context: context label: title contents: contentsStringOrNil fullView: bool
"open a debugger - the two versions for mvc & morphic are very close and can surely be merged so that this can be removed"
^nil!
Item was changed:
+ ----- Method: DummyUIManager>>openFancyMailComposition: (in category 'ui project indirecting') -----
- ----- Method: DummyUIManager>>openFancyMailComposition: (in category 'ui requests') -----
openFancyMailComposition: fancyMail
"FancyMailComposition should probably be removed in favour of MailComposition, but at least ought to be made a ToolBuilder thing"
^nil!
Item was changed:
+ ----- Method: DummyUIManager>>openPluggableFileList:label:in: (in category 'ui project indirecting') -----
- ----- Method: DummyUIManager>>openPluggableFileList:label:in: (in category 'ui requests') -----
openPluggableFileList: aPluggableFileList label: aString in: aWorld
"PluggableFileList is being deprecated and this can go away soon"
^nil!
Item was removed:
- ----- Method: DummyUIManager>>openPluggableFileListLabel:in: (in category 'ui requests') -----
- openPluggableFileListLabel: aString in: aWorld
- "PluggableFileList is being deprecated and this can go away soon"
- ^nil!
Item was changed:
----- Method: DummyUIManager>>request:initialAnswer: (in category 'ui requests') -----
request: queryString initialAnswer: defaultAnswer
+ self askForProvidedAnswerTo: queryString ifSupplied: [:answer |
+ ^ answer = #default
+ ifTrue: [defaultAnswer]
+ ifFalse: [answer]].
- (ProvideAnswerNotification signal: queryString)
- ifNotNil: [:answer |
- ^ answer == #default ifTrue: [defaultAnswer] ifFalse: [answer]].
self error: 'No user response possible'!
Item was changed:
----- Method: DummyUIManager>>requestPassword: (in category 'ui requests') -----
requestPassword: queryString
+
^ self request: queryString initialAnswer: ''!
Item was changed:
+ ----- Method: DummyUIManager>>resumeDebugger:process: (in category 'ui project indirecting') -----
- ----- Method: DummyUIManager>>resumeDebugger:process: (in category 'ui requests') -----
resumeDebugger: aDebugger process: aTopView
"resume a debugger - the two versions for mvc & morphic are very close and can surely be merged so that this can be removed"
^nil!
Item was changed:
----- Method: DummyUIManager>>saveFilenameRequest:initialAnswer: (in category 'ui requests') -----
saveFilenameRequest: queryString initialAnswer: defaultAnswer
"Open a FileSaverDialog to ask for a place and filename to use for saving a file. The initial suggestion for the filename is defaultAnswer but the user may choose any existing file or type in a new name entirely"
+ self askForProvidedAnswerTo: queryString ifSupplied: [:answer |
+ ^ answer = #default
+ ifTrue: [defaultAnswer]
+ ifFalse: [answer]].
- (ProvideAnswerNotification signal: queryString)
- ifNotNil: [:answer |
- ^ answer == #default ifTrue: [defaultAnswer] ifFalse: [answer]].
self error: 'No user response possible'!
Item was changed:
+ ----- Method: DummyUIManager>>startUpMenu:withCaption:icon:at:allowKeyboard: (in category 'ui project indirecting') -----
- ----- Method: DummyUIManager>>startUpMenu:withCaption:icon:at:allowKeyboard: (in category 'ui requests') -----
startUpMenu: aMenu withCaption: captionOrNil icon: aForm at: location allowKeyboard: aBoolean
"A menu needs to startup and depends on the current type of ui manager for what sort of startup to do. Very ugly, and really needs replacing with a much better menu system"
^nil
!
Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1465.mcz
==================== Summary ====================
Name: Morphic-pre.1465
Author: pre
Time: 1 November 2018, 2:51:21.106173 pm
UUID: b01c1a41-f7e1-2345-8c9a-6cc6f325a87c
Ancestors: Morphic-eem.1464
Removes ProvideAnswerNotification code from several Morphs as it is now handled in the corresponding UIManager
=============== Diff against Morphic-eem.1464 ===============
Item was changed:
----- Method: DialogWindow>>getUserResponse (in category 'running') -----
getUserResponse
| hand world |
- (ProvideAnswerNotification signal: self message asString)
- ifNotNil: [:answer|
- ^ answer = #default
- ifTrue: [result]
- ifFalse: [answer]].
-
self message ifEmpty: [messageMorph delete]. "Do not waste space."
self paneMorph submorphs ifEmpty: [self paneMorph delete]. "Do not waste space."
hand := self currentHand.
world := self currentWorld.
self fullBounds.
self moveToPreferredPosition.
self openInWorld: world.
hand showTemporaryCursor: nil. "Since we are out of context, reset the cursor."
hand keyboardFocus in: [:priorKeyboardFocus |
hand mouseFocus in: [:priorMouseFocus |
self exclusive ifTrue: [hand newMouseFocus: self].
hand newKeyboardFocus: self.
[self isInWorld] whileTrue:[world doOneSubCycle].
hand newKeyboardFocus: priorKeyboardFocus.
hand newMouseFocus: priorMouseFocus]].
^ result!
Item was changed:
----- Method: MenuMorph class>>chooseFrom:lines:title: (in category 'utilities') -----
chooseFrom: aList lines: linesArray title: queryString
"Choose an item from the given list. Answer the index of the selected item."
- "MenuMorph
- chooseFrom: #('Hello' 'World' 'Here' 'We' 'Go')
- lines: #(2 4)
- title: 'What''s up?'"
| menu aBlock result |
- (ProvideAnswerNotification signal: queryString) ifNotNil:[:answer |
- 1 to: aList size do:[:i| (aList at: i) = answer ifTrue:[^i]].
- ^0].
aBlock := [:v| result := v].
menu := self new.
menu addTitle: queryString.
1 to: aList size do:[:i|
menu add: (aList at: i) asString target: aBlock selector: #value: argument: i.
+ (linesArray includes: i) ifTrue:[menu addLine]].
- (linesArray includes: i) ifTrue:[menu addLine]
- ].
MenuIcons decorateMenu: menu.
result := 0.
menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.
^result!
Item was changed:
----- Method: MenuMorph class>>chooseFrom:values:lines:title: (in category 'utilities') -----
chooseFrom: aList values: valueList lines: linesArray title: queryString
"Choose an item from the given list. Answer the index of the selected item."
+ | index |
+ index := self chooseFrom: aList lines: linesArray title: queryString.
+ ^ valueList at: index ifAbsent: [nil]!
- "MenuMorph
- chooseFrom: #('Hello' 'World' 'Here' 'We' 'Go')
- values: #('Hello' 'World' 'Here' 'We' 'Go')
- lines: #(2 4)
- title: 'What''s up?'"
- | menu aBlock result |
- (ProvideAnswerNotification signal: queryString) ifNotNil:[:answer |
- 1 to: aList size do:[:i| (aList at: i) = answer ifTrue:[^answer]].
- ^nil].
- aBlock := [:v| result := v].
- menu := self new.
- menu addTitle: queryString.
- 1 to: aList size do:[:i|
- menu add: (aList at: i) asString target: aBlock selector: #value: argument: (valueList at: i).
- (linesArray includes: i) ifTrue:[menu addLine]
- ].
- MenuIcons decorateMenu: menu.
- result := nil.
- menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.
- ^result!
Item was changed:
----- Method: MenuMorph class>>confirm:trueChoice:falseChoice: (in category 'utilities') -----
confirm: queryString trueChoice: trueChoice falseChoice: falseChoice
"Put up a yes/no menu with caption queryString. The actual wording for the two choices will be as provided in the trueChoice and falseChoice parameters. Answer true if the response is the true-choice, false if it's the false-choice. This is a modal question -- the user must respond one way or the other."
"MenuMorph
confirm: 'Are you hungry?'
trueChoice: 'yes, I''m famished'
falseChoice: 'no, I just ate'"
| menu aBlock result |
- (ProvideAnswerNotification signal: queryString)
- ifNotNil:[:answer | ^ trueChoice = answer].
aBlock := [:v| result := v].
menu := self new.
menu addTitle: queryString icon: MenuIcons confirmIcon.
menu add: trueChoice target: aBlock selector: #value: argument: true.
menu add: falseChoice target: aBlock selector: #value: argument: false.
MenuIcons decorateMenu: menu.
[menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.
result == nil] whileTrue.
^result!
Item was changed:
----- Method: MenuMorph class>>inform: (in category 'utilities') -----
inform: queryString
"MenuMorph inform: 'I like Squeak'"
| menu |
- (ProvideAnswerNotification signal: queryString)
- ifNotNil:[:answer | ^ self].
menu := self new.
menu addTitle: queryString icon: MenuIcons confirmIcon.
menu add: 'OK' target: self selector: #yourself.
MenuIcons decorateMenu: menu.
menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.!