  OPTION SCALE, 96
  TITLE By Mac
  if @ask("Use Single Font Display?"@tab())
    DIALOG CREATE,Scan Codes,-1,0,280,400
    DIALOG ADD,STYLE,Style1,Arial,16
    DIALOG ADD,LIST,LB1,10,10,260,380,Style1,CLICK
    DIALOG SHOW
    %x = 0
    REPEAT 
      LIST ADD, LB1, "@chr("%x")" = @chr(%x)
      %x = @succ(%x)
    UNTIL @greater(%x, 255)
    :EVLOOP1 
    WAIT EVENT
    goto @event()
    :LB1CLICK 
    CLIPBOARD SET, @item(LB1)
    goto EVLOOP1
  end 

  rem -- Don't show main, only need it to have child dialog --
  DIALOG CREATE,"Main Dialog",0,0,0,0

  %%style = "Arial"
  %%pos = 0

:GetFontSize
  %%size = @input("Enter a font size (6-36):", 24)
  if @not(%%size) @not(@numeric(%%size)) @not(@both(@greater(%%size, 5),@greater(37, %%size)))
    goto CreateDialog
  end 

:CreateDialog
  DIALOG CREATE,"@chr( ) Scan Codes",-1,0,230,190
  DIALOG ADD,STYLE,%%style,%%style,%%size,,WHITE
  DIALOG ADD,LIST,Numbers,5,5,90,90,CLICK
  DIALOG ADD,COMBO,Font,5,100,125,20,,LIST,CLICK
  DIALOG ADD,EDIT,ED1,30,100,65,65,,MULTI,WRAP,READONLY,%%style
  DIALOG ADD,TEXT,TypeTxt,102,5,,,"Type chars in here if you wish:"
  DIALOG ADD,EDIT,ED2,120,5,160,65,,MULTI,TABS,%%style
  DIALOG ADD,TEXT,FontSize,43,175,,,Size: %%size
  DIALOG ADD,BUTTON,ChangeSize,70,170,55,25,"Change"
  DIALOG ADD,BUTTON,Help,100,170,55,25
  DIALOG ADD,BUTTON,Check,130,170,55,25
  DIALOG ADD,BUTTON,Clear,160,170,55,25
  DIALOG SHOW

  LIST LOADTEXT, Font,
"Arial
"Arial Black
"Comic Sans MS
"Courier
"Courier New
"Fixedsys
"Gill Sans MT
"Impact
"Marlett
"MS Sans Serif
"MS Serif
"Small Fonts
"Symbol
"System
"Times New Roman
"Verdana
"Wingdings

  LIST SEEK, Font, 0
  if @match(Font, %%style)
    rem -- This displays %%style in combo --
  end 

  %x = 0
  REPEAT 
    if @greater(10, %x)
      %x = 0%x
    end 
    LIST ADD, Numbers, "@chr("%x")"
    %x = @succ(%x)
  UNTIL @greater(%x, 255)
  LIST SEEK, Numbers, %%pos

:EVLOOP
  WAIT EVENT
  goto @event()

:ChangeSizeBUTTON
  if @greater(@index(Numbers), -1)
    %%pos = @index(Numbers)
  end 
  DIALOG SELECT, 1
  DIALOG CLOSE
  goto GetFontSize

:HelpBUTTON
  INFO "You can click on the @chr() number on the"@tab()@cr()"left, or enter a char in the bottom edit box."@cr()"Press the Check button to locate the char's"@cr()"@chr() number."@cr()@cr()"Tip: To find ENTER and TAB numbers, enter"@cr()"       a char first."
  goto EVLOOP

:CheckBUTTON
  if @dlgtext(ED2)
    %s = @substr(@dlgtext(ED2), @len(@dlgtext(ED2)))
    %x = 0
    REPEAT 
      %n = @substr(@item(Numbers, %x), 6, 7)
      if @equal(%s, @chr(%n), EXACT)
        CLIPBOARD SET, @item(Numbers)
        %x = @pred(@count(Numbers))
      end 
      %x = @succ(%x)
    UNTIL @equal(%x, @count(Numbers))
  end 
  goto EVLOOP

:ClearBUTTON
  DIALOG CLEAR, ED2
  goto EVLOOP

:NumbersCLICK
  DIALOG SET, ED1, @chr(@index(Numbers))
  CLIPBOARD SET, @item(Numbers)
  goto EVLOOP

:FontCLICK
  %%style = @item(Font)
  if @greater(@index(Numbers), -1)
    %%pos = @index(Numbers)
  end 
  DIALOG SELECT, 1
  DIALOG CLOSE
  goto CreateDialog

:CLOSE
  EXIT 
