EDIT FIELDs, BUTTONs Stop PRINT Scrolling in Mac QuickBASIC (33624)






This article was previously published under Q33624

SUMMARY

EDIT FIELDs and BUTTONs prevent the PRINT, PRINT USING, LINE INPUT, or INPUT statements from scrolling the output window. Normally, PRINT and PRINT USING scroll the pixels on the window when they print at the bottom of the window. Similarly, INPUT or LINE INPUT statements executing at the bottom of the window scroll the image on the window up one line when you press RETURN.

BASIC prevents the scrolling so that the EDIT FIELDs and BUTTONs stay on the screen for user input. If EDIT FIELDs or BUTTONs were scrolled away, you could not respond to them.

This information applies to Microsoft QuickBASIC Compiler Version 1.00, Microsoft BASIC Compiler Version 1.00, and Microsoft BASIC Interpreter Versions 2.00, 2.10, and 3.00 for Apple Macintosh.

MORE INFORMATION

Note: You can set up an area of scrollable static text with the NewScroll and ScrollText statements (which are MBLC routines built into QuickBASIC). (The ToolBoxSampler program on the release disk demonstrates them.) This type of specialized scrolling area can coexist next to EDIT FIELDs or BUTTONs on a window and still scroll. A Toolbox-created scrolling area is useful only for displaying a given array of strings that can be selected with the mouse.

Listed below is an example of how to make a window, create an EDIT FIELD, create a BUTTON, and capture the input in the EDIT FIELD. This example polls the value returned by DIALOG(0) in a loop, waiting for you to press the BUTTON or hit the RETURN key. You can input and edit text in the EDIT FIELD while the program loops and waits for you to press the BUTTON or press the RETURN key.

The following is a code example:
WINDOW 2,"GET NAME",(70,70)-(430,320),1
PRINT "ENTER YOUR NAME IN THE BOX"
PRINT "WHEN FINISHED, CLICK OK."
EDIT FIELD 1,"{{ENTER TEXT HERE}}",(50,50)-(200,200),1,1
BUTTON 1,1 "DONE",(85,205)-(170,225)
IDLE=1      ' 1 or non-zero is TRUE; zero is FALSE.
WHILE IDLE  ' This loop polls DIALOG(0) waiting for an event.
   ACT=DIALOG(0)  ' Invoke DIALOG(0) only once per loop iteration.
   IF (ACT=1 OR ACT=6) THEN  ' 1=Button clicked; 6=RETURN key pressed
   TITLE$=EDIT$(1)
   IDLE=0
   ELSE
   IDLE=1
   END IF
WEND
WINDOW CLOSE 2
PRINT "HELLO! YOU MUST BE";TITLE$;"."
PRINT:
PRINT "CLICK TO END"
WHILE MOUSE(0)<>1 : WEND
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB33624