!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Tests the time readout in a gcontrol flickering.
! See BUGs 1208 and 1065
! @author  J. Bauer
! @version $Id: test_gcontrol_flicker.mm,v 1.3 2010/12/15 16:18:00 jwb Exp $
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
startmacro/msgid=main
  switch INTERACTIVE interAct GET DEF=TRUE
  switch BASELINE    baseline GET DEF=FALSE

  call getTime

  pipe on
    set instructions "The time in the gcontrol should not blink or flicker when &
                      double-buffering is TRUE. &
                      Change the double-buffering from True to False. The timer &
                      will eventually flicker (may take a long time and may not &
                      happen at all on Windows)."

    panel/setup/controls=gc

    gcontrol label macro "MACRO"
    	gcontrol menu main "Exit with Status = " "PASS,FAIL" /tleft
    		set gc.main.itemColors {PASS=GREEN,FAIL=RED}
      gcontrol text idtext  "INSTRUCTIONS" "^instructions" 24 8 /title
    
    gcontrol button toggleDB "Double Buffer Widgets" "True,False" "True"
    gcontrol prompt showDBVal "Current Widget DB Value: "  /noedit
    
    gcontrol prompt time  "Time:" timeStr

    set reg.panel.timer(0) 1
    
    set gc.time.doubleBufferWidgets true
    set gc.showDBVal.value ^gc.time.doubleBufferWidgets
  pipe off
endmacro

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
procedure processMessage m:msg
  !say "Msg ^msg.name = ^msg.data"
  if msg.name EQS "MAIN" then
    assert/text="TEST_GCONTROL_FLICKER" "PASS" SUBS msg.data
    pipe stop
    
  elseif msg.name EQS "TOGGLEDB" then
    set gc.time.doubleBufferWidgets ^msg.data
    set gc.showDBVal.value ^gc.time.doubleBufferWidgets

  elseif msg.name EQS "TIMER" then
    call getTime
    if reg.panel.controls.time rexists then
      ! The next two lines cause a refresh problem in NeXtMidas 2.1.0 - Bug 269
      set reg.panel.controls.time.show  1
      set reg.panel.controls.time.value timeStr
    endif
  else
     !say "Unhandled message ^msg.name from ^msg.fid"
  endif
return


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
procedure getTime
  timex now mjs=curTime
  invoke timeStr nxm.sys.lib.Time.toString(curTime)
return
