+----------------------------------------------------------------------+
|                      I * C * E * T * I * P * S                       |
|                                                                      |
|                        Nr 4,  March 6th 1995                         |
|                                                                      |
|                         Presented to you by                          |
|                      Arnor Baldvinsson, ICELAND                      |
+----------------------------------------------------------------------+

Well, this should be nr. 3.1, but I couldn't resist...

Ever wanted to get user input without creating a seperate form for it?
In Visual Basic you can call InputBox function to get user input.  So I 
created this InsertBox function to use when I want a simple input from the
user.  You include the source file in the Project and you are on your way.
This one allows you to pass the entry string to the function, which 
corresponds to the default option in VB.  Say you have a string variable
called MyText.  You can call the InsertBox now with:

MyText = 'Some text'
MyText = InsertBox('Please enter text...',MyText,'Window title')

If the user presses the Cancel button the function returns an empty string ('')
otherwise it returns the user input.  The prompt is centered above the input
field and the window is centered on the screen.  You might change it so that you
could pass the position like you can do with VB InputBox.  OK so here goes:



         MEMBER('YourAppNameHere')

InsertBox      FUNCTION(IBW_PromptField,IBW_EntryField,IBW_WindowTitle)
! Prototype:  InsertBox(STRING         ,*STRING       ,STRING)         ,
STRING, PASCAL

WindowOpened         LONG
WindowInitialized    LONG
ForceRefresh         LONG,AUTO

InsertBoxW WINDOW('
'),AT(,,182,53),FONT('Arial',10,,FONT:regular),CENTER,SYSTEM,GRAY,DOUBLE,MODAL
       STRING(@s40),AT(6,6,169,10),FONT('Arial',10,,FONT:bold),USE(IBW_Promp
tField),CENTER
       ENTRY(@s40),AT(6,19,169,12),USE(IBW_EntryField),LEFT(1)
       BUTTON('&Cancel'),AT(38,35,40,14),USE(?IBW_Cancel)
       BUTTON('&Ok'),AT(97,35,40,14),USE(?IBW_OK),DEFAULT
     END

  CODE
  OPEN(InsertBoxW)
  InsertBoxW{PROP:Text} = IBW_WindowTitle
  WindowOpened=True

  ACCEPT
    CASE EVENT()
    OF EVENT:OpenWindow
      IF NOT WindowInitialized
        DO InitializeWindow
      END
      SELECT(?IBW_PromptField)
    OF EVENT:GainFocus
      WindowInitialized = True
      DO InitializeWindow
    END
    CASE FIELD()
    OF ?IBW_OK
      CASE EVENT()
      OF EVENT:Accepted
        POST(Event:CloseWindow)
        DO RefreshWindow
      END
    OF ?IBW_Cancel
      CASE EVENT()
      OF EVENT:Accepted
        IBW_EntryField = ''
        POST(EVENT:CLOSEWINDOW)
        DO RefreshWindow
      END
    END
  END
  IF WindowOpened
    CLOSE(InsertBoxW)
  END
  RETURN(IBW_EntryField)

InitializeWindow ROUTINE
  ForceRefresh = True
  DO RefreshWindow

RefreshWindow ROUTINE
  DISPLAY()
  ForceRefresh = False

!END OF FUNCTION InsertBox
!-------------------------


***** COMING UP NEXT on ICETIPS:  *****

Allow users to change fonts in your table windows and store it in the
application 
INI file.  More API calls - retrieve the Windows and System directories.


