TEXTEDITOR !insert command is local in scope

From Liberty BASIC Family
Jump to navigation Jump to search


Description

The TEXTEDITOR !insert command can only use local variables, global variables and arrays are ignored.

Example code to demonstrate the bug.

  nomainwin
  global globaltext$
  globaltext$="This is some insert text"
  WindowWidth =500
  WindowHeight = 500
  UpperLeftX=int((DisplayWidth-WindowWidth)/2)
  UpperLeftY=int((DisplayHeight-WindowHeight)/2)
  texteditor #main.gb,10,30,400,400
  button #main.insert,"Insert",insertvar,UL,410,380,50,25
  open "Editor" for window as #main
  #main "trapclose [exit]"
  wait
[exit]
  close #main
  end
sub insertvar handle$
  'localvar$=globaltext$
  '#main.gb "!contents localvar$";
  '#main.gb "!insert localvar$";
  #main.gb "!contents globaltext$";
  #main.gb "!insert globaltext$";
end sub

Example code to work around the bug.

'unrem the lines in the above code, this creates a local variable