[plt-scheme] test:get-active-frame Problem

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Mar 16 16:12:22 EST 2003

The problem is with the example, which has been since removed from the
framework manual (It should not have gone out with v203). There is no
test:get-active-frame anymore, instead use get-top-level-focus-window,
which is now a builtin function.

In general, this example is manipulating DrScheme it self, which means
that the code cannot be run from the definitions window, but that it
must be run from a privaledged place that is only available for
debugging DrScheme, so the example is of little use. Hopefully, you can
make a simple example yourself, based on the app you want to test. Let
me know if you get stuck.

Robby

At Sun, 16 Mar 2003 12:56:52 -0800 (PST), Shawn Legrand wrote:
> ------------------------------------------------------------------------------
> 
> When trying to run the frame fact example in section 3.3.1 of the PLT Framework: GUI 
> Application Framework manual I am receiving an error message: reference to undefined 
> identifier: test:get-active-frame. I have the (require (lib "framework.ss" 
> "framework"))statement, in fact if I remove that statement I then fail on the test:new-
> window statement, so it appears the require is functioning correctly.. I have looked at 
> test.ss and it appears to me that the get-active-frame define is in there and should be 
> OK (but I am a newbie to DrScheme so that may mean little). I have searched the list 
> archive with no hits.
> 
> Here is my code:
> 
> (require (lib "framework.ss" "framework")) 
> (define go
>     (lambda ()
>       (sleep 3)
>       (test:new-window (get-panel '(0 0 0 1)))       ; definitions canvas
>       (test:menu-select "Edit" "Select All")
>       (test:menu-select "Edit" "Delete")
>       (type-line "(define fact")
>       (type-line "(lambda (n)")
>       (type-line "(if (zero? n)")
>       (type-line "1")
>       (type-line "(* n (fact (sub1 n))))))")
>       (test:button-push (get-panel '(0 0 0 0 5 0)))  ; check-syntax button
>       (test:button-push (get-panel '(0 0 0 0 5 3)))  ; execute button
>       (sleep 3)
>        (type-line "(fact 4)")
>       (sleep 1)
>       (printf "Test complete. Pending actions: ~s~n" 
>               (test:number-pending-actions))))
> 
>   (define type-line
>     (lambda (str)
>       (for-each test:keystroke (string->list str))
>       (test:keystroke #\return)))
> 
>   (define get-panel
>     (lambda (path)
>       (let loop ([path  path] 
>                  [panel (send (test:get-active-frame) get-top-panel)])
>         (if (null? path)
>             panel
>             (loop (cdr path) 
>                   (list-ref (ivar panel children) (car path)))))))
> 
> 
> I am running language Pretty Big (includes MrEd and Advanced) at version 203.
> 
> Any help would be appreciated.
> 
> 
> Shawn Legrand 
> Carpe Noctem! Carpe Diem! Hieros Gamos!
> splegrand at yahoo.com
> ------------------------------------------------------------------------------
> 
> When trying to run the frame fact example in section 3.3.1 of the PLT Framework: GUI 
> Application Framework manual I am receiving an error message: reference to undefined 
> identifier: test:get-active-frame. I have the (require (lib "framework.ss" 
> "framework"))statement, in fact if I remove that statement I then fail on the test:new-
> window statement, so it appears the require is functioning correctly.. I have looked at 
> test.ss and it appears to me that the get-active-frame define is in there and should be 
> OK (but I am a newbie to DrScheme so that may mean little). I have searched the list 
> archive with no hits.
> 
> Here is my code:
> 
> (require (lib "framework.ss" "framework")) 
> (define go
>     (lambda ()
>       (sleep 3)
>       (test:new-window (get-panel '(0 0 0 1)))       ; definitions canvas
>       (test:menu-select "Edit" "Select All")
>       (test:menu-select "Edit" "Delete")
>       (type-line "(define fact")
>       (type-line "(lambda (n)")
>       (type-line "(if (zero? n)")
>       (type-line "1")
>       (type-line "(* n (fact (sub1 n))))))")
>       (test:button-push (get-panel '(0 0 0 0 5 0)))  ; check-syntax button
>       (test:button-push (get-panel '(0 0 0 0 5 3)))  ; execute button
>       (sleep 3)
>    & nbsp;   (type-line "(fact 4)")
>       (sleep 1)
>       (printf "Test complete. Pending actions: ~s~n" 
>               (test:number-pending-actions))))
> 
>   (define type-line
>     (lambda (str)
>       (for-each test:keystroke (string->list str))
>       (test:keystroke #\return)))
> 
>   (define get-panel
>     (lambda (path)
>       (let loop ([path  path] 
>                  [panel (send (test:get-active-frame) get-top-panel)])
>         (if (null? path)
>             panel
>             (loop (cdr path) 
>                   (list-ref (ivar panel children) (car path)))))))
> 
> I am running language Pretty Big (includes MrEd and Advanced) at version 203.
> 
> Any help would be appreciated.
> 
> Shawn Legrand 
> Carpe Noctem! Carpe Diem! Hieros Gamos!
> splegrand at yahoo.com 


Posted on the users mailing list.