news
About Elegant Chaos
info
About me and my friends
people
Software from Elegant Chaos
software
Other stuff...
stuff

UL_GetTextWindow

Revision 1
Revised on 19/03/95 18:56

Description

Create an external text window. Takes the name of the window, the display options to use, and optionally the initial contents of the window.

The options parameter can contain a number of options, seperated by commas. The routine returns a boolean saying whether or not the window was successfuly created.

An example usage might be:

put "test window" into name put "floating,scrollbar 8,not visible" into options put "hello world!" into text

if GetTextWindow(name,options,text) then set the loc of window name to 100,100 show window name -- etc... end if

Note that this routine is implemented using the TextView XCMD, and is provided as a simpler interface to it. See the TextView XCMD for more information.

The options that can be passed to UL_GetTextWindow are:

floating not floating -- is the window a floating palette?

title no title -- should the window display its title?

visible not visible -- should the window start visible?

scrollbar <w> -- set the width of the scrollbar to <w>

wrap dont wrap -- should text in the window wrap

dragable not dragable -- should text in the window be dragable

click <msg> -- set the message sent when text in the window is clicked

whole not whole -- should whole lines be selected at once?

editable not editable -- is the text editable?


Code

function UL_GetTextWindow name,options,oText
  put true into oFloating
  put true into oTitle
  put true into oVisible
  put true into oClosebox
  put false into oDontWrap
  put false into oDragable
  put false into oEditable
  put 8 into oScrollbar
  put empty into oClickMessage
  put false into oWholeLine
  
  repeat with n = 1 to the number of items in options
    get item n of options
    put word 1 of it into command
    put true into state
    if (command is "no") or (command is "not") or (command is "dont") then
      put false into state
      put word 2 of it into command
    end if
    
    if command is "floating" then
      put state into oFloating
      
    else if command is "title" then
      put state into oTitle
      
    else if command is "visible" then
      put state into oVisible
      
    else if command is "scrollbar" then
      put word 2 of it into oScrollbar
      
    else if command is "wrap" then
      put not state into oDontWrap
      
    else if command is "dragable" then
      put state into oDragable
      
    else if command is "click" then
      put word 2 of it into oClickMessage
      
    else if command is "whole" then
      put state into oWholeLine
      
    else if command is "editable" then
      put state into oEditable
    end if
  end repeat
  
  if oFloating then
    put 0 into var
    put "Grey" into WDEF
    if oTitle then
      put 2 into var
    end if
    if not oClosebox then
      put 1 into var
    end if
    put comma & var after WDEF
  else
    put 0 into WDEF
  end if
  
  put (there is a window name) into gotIt
  if not gotIt then
    TextView name,oFloating,wdef
    put (there is a window name) into gotIt
  end if
  
  if gotIt then
    set the scrollbar of window name to oScrollbar
    set the dontWrap of window name to oDontWrap
    set the text of window name to oText
    set the clickMessage of window name to oClickMessage
    set the wholeLine of window name to oWholeLine
    set the dragable of window name to oDragable
    set the editable of window name to oEditable
    
    if oVisible then show window name
  end if
  
  return gotIt
  
end UL_GetTextWindow