All pastes #73584 Raw Edit

Someone

public text v1 · immutable
#73584 ·published 2006-06-28 00:48 UTC
rendered paste body
dialog clock {
  title "Pizza clock"
  size -1 -1 108 40
  option dbu
  edit "", 1, 20 8 50 10
  text "Time:", 2, 4 8 13 8
  text "(in minutes)", 3, 72 10 31 8
  button "Start clock", 4, 4 22 99 12, ok
}

dialog error {
  title "Error: you need to..."
  size -1 -1 84 40
  option dbu
  text "You need to type something in the textfield", 1, 4 4 77 14
  button "Ok", 2, 22 22 37 12
}

dialog theclock {
  title "Pizza clock2"
  size -1 -1 84 38
  option dbu
  edit "", 1, 26 4 50 10
  text "Time left:", 2, 2 4 23 8
  button "Reset", 3, 24 20 37 12, ok
}

On *:DIALOG:clock:sclick:4: {
  var %clock = $did(clock,1).text 
  var %clocksec = $calc(($gettok(%clock,1,58) * 60) + $gettok(%clock,2,58))
  hadd -m clock ctime %clocksec
  .timerdecclock %clocksec 1 clockdec
  if (!$did(clock,1)) {
    dialog -m error error
  }
  elseif ($did(clock,1)) {
    dialog -m theclock theclock
    did -a theclock 1 %clock
  }
}

on *:DIALOG:error:sclick:2: {
  dialog -m clock clock
  dialog -x error error
}

on *:DIALOG:theclock:sclick:3: {
  dialog -m clock clock
  dialog -x theclock theclock
}

alias clockdec {
  if ($dialog(theclock)) {
    hdec clock ctime
    did -r theclock 1
    did -a theclock 1 $asctime($hget(clock,ctime),nn:ss)
  }
}