|
What is the correct way to (for instance) bring up a Tweak dialog box
from a TAvatarUser? In my game code I've just received a signal from
the avatar replica with a data project with dialog data. And I want to
display the data that is in it, get a response from the human at the
keyboard, and send that back into the island. The code I'm using
currently looks like:
DialogData>>confirmWithUser: user
| script |
script := user startScript: [
| dlg choice |
self DEBUGLOG logNote: 'start confirm script'.
dlg := self windowClass new .
dlg dialogLabel value: 'Sailing Trip'.
dlg messageText contents: message asText allBold.
dlg messageText allowEditing: false.
dlg messageText hResizing: #shrinkWrap; vResizing: #shrinkWrap.
dlg buttonRow removeAll.
buttons
do: [ :eachButtonSpec |
| bLabel bValue button |
bLabel := ' ' , (eachButtonSpec at: 1) , ' '.
bValue := eachButtonSpec at: 2.
button := dlg addButton: bLabel value: bValue.
button hResizing: #shrinkWrap.
].
self DEBUGLOG logNote: 'before run in confirm script'.
choice := dlg run: nil centerAt: (512@350).
self DEBUGLOG logNote: 'before dialog choice in confirm script'.
user requestDialogChoice: choice. "does a [replica future
sendReply: choice] "
self DEBUGLOG logNote: 'finish confirm script'.
].
script setScheduler: user island project world ownerMorph
scriptScheduler.
script resume.
The problem with that is it sometimes doesn't work. When it fails, the
log shows it getting up to the "before run" and it doesn't show the
dialog. So is this even the correct approach? I'm using Croquet 1.0 beta
without updates.
-- John Dougan
|