[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Window questions



    Date: Wed, 15 Jan 1992 23:17 CST
    From: myers@atr-ln.atr.co.jp (John K. Myers)

[...]

    What is the magic for defining a pane without a save-history in dw:define-program-framework?

Make the pane flavor based on TV:Window-Pane and have it handle the
1:Margin-Components0 :init-keyword.  [See below.]

    One straightforward way would be to define a simple, non-dynamic window pane.
    However, :PANES ((PANE-1 :DISPLAY :FLAVOR TV:WINDOW-PANE)...) complains loudly.
    I want something simple where I can explicitly move the cursor to pixel locations

Do you really want to explicitly move the cursor?  Or is it good enough
to just do a (GRAPHICS:Draw-String ...) ?  The latter is cleaner,
especially if the screen is busy.  Try the following comparison:

  Foo command: Draw Strings (how many? [default 10]) 1000 (set cursor? [default No]) Yes
  Foo command: Clear Window
  Foo command: Draw Strings (how many? [default 10]) 1000 (set cursor? [default No]) No


Examples of both are below.

    and display characters directly onto the screen bits, then clear the window for the
    next time, instead of making thousands of presentations that take up space and time.

    My apologies if these simple questions have been answered before; couldn't find them.
    Best regards,          John Myers~~



;;; -*- Syntax: Common-Lisp; Package: USER; Base: 10; Mode: LISP -*-

(defflavor 2My-Window 0()
	   (TV:Window-Pane)
  (:Init-Keywords 1:Margin-Components0))

(DW:Define-Program-Framework 2Foo
0  :Command-Definer T
  :Command-Table (:Inherit-From '("Colon Full Command"
				  "Standard Arguments"
				  "Input Editor Compatibility")
		  :KBD-Accelerator-P 'NIL)
  :State-Variables NIL
  :Panes ((No-History :Display
		      :Flavor My-Window)
	  (Interactor :Interactor))
  :Configurations '((DW::Main
		      (:Layout (DW::Main :Column
					 No-History
					 Interactor))
		      (:Sizes (DW::Main
				(Interactor 200)
				:Then
				(No-History :Even))))))

(Define-Foo-Command 2(Com-Draw-Strings)
0    ((N 'number
	:Prompt "how many?")
     (Set-Cursor 'boolean
		 :Prompt "set cursor?"))
   (Let* ((Pane (DW:Get-Program-Pane 'No-History))
	  (Width (Send Pane :Inside-Width))
	  (Height (Send Pane :Inside-height))
	  (Strings '("Foo" "Bar" "F.U.B.A.R." "BAZ" "Ack" "Phthptt")))
     (loop Repeat N
	   for String = (Nth (random (length Strings))
			     Strings)
	   for X = (random Width)
	   for Y = (random Height)
	   do (if Set-Cursor
		  (progn
		    (Send Pane :Set-Cursorpos X Y)
		    (Format Pane "~A" String))
		  (GRAPHICS:Draw-String String X Y
					:Stream Pane)))))

(Define-Foo-Command 2(Com-Clear-Window)
0    ()
   (Send (DW:Get-Program-Pane 'No-History) :Clear-Window))