4848 variable CurrentScriptName
4949 variable Action
5050 variable Source
51+ variable Running
5152 variable N
5253
5354 ! The browser
@@ -306,13 +307,16 @@ L2:
306307 end
307308 end
308309
310+ on click RunStop go to DoRunStop
311+
309312 gosub to CreateNewPresentation
310313 put Presentation into LastSavedState
311314 gosub to SetupSteps
312315 gosub to SetupBlocks
313316 gosub to SetupContent
314317 put 0 into N
315318 gosub to SelectSection
319+ clear Running
316320
317321 on message
318322 begin
322326 else if Action is `refresh`
323327 begin
324328 iwsy script Presentation
325- gosub to UpdateCurrentSection
329+ set style `display` of StepsPanel to `none`
330+ set style `display` of BlocksPanel to `none`
331+ set style `display` of ContentPanel to `none`
332+ if Section is 0 set style `display` of StepsPanel to `block`
333+ else if Section is 1 set style `display` of BlocksPanel to `block`
334+ else if Section is 2 set style `display` of ContentPanel to `block`
326335 end
327336 end
328337 stop
@@ -506,6 +515,7 @@ SelectFile:
506515 set the content of Status to `Presentation '` cat File cat `' loaded`
507516 fork to ResetStatus
508517 set ShowRun
518+ print Presentation
509519 iwsy load Player Presentation
510520
511521CloseBrowser:
@@ -527,6 +537,45 @@ ResetStatus:
527537 set the content of Status to ``
528538 stop
529539
540+ DoRunStop:
541+ if Running
542+ begin
543+ clear Running
544+ gosub to ClearStepsButtons
545+ set attribute `src` of RunStop to `resources/icon/run.png`
546+ iwsy stop
547+ end
548+ else
549+ begin
550+ set Running
551+ put property `steps` of Presentation into Item
552+ if the json count of Item is 0 stop
553+ set attribute `src` of RunStop to `resources/icon/runstop.png`
554+
555+ iwsy onstep
556+ begin
557+ set Message to object
558+ set property `action` of Message to `step`
559+ set property `step` of Message to the step
560+ send Message to StepsModule
561+ end
562+
563+ iwsy run then
564+ begin
565+ gosub to ClearStepsButtons
566+ set attribute `src` of RunStop to `resources/icon/run.png`
567+ clear Running
568+ stop
569+ end
570+ end
571+ stop
572+
573+ ClearStepsButtons:
574+ set Message to object
575+ set property `action` of Message to `clear`
576+ send Message to StepsModule
577+ return
578+
530579GetPassword:
531580 if ReadOnly
532581 begin
0 commit comments