dialog.stk doesn't do "grab"

From: Grant Edwards <grante_at_rosevax.rosemount.com>
Date: Thu, 1 Dec 1994 13:06:19 -0600 (CST)

Hi,

I've been working on a todo-list application in STk, and ran into a
glitch with the "dialog" package in /usr/local/lib/stk/dialog.stk.
Even when the "grabbing" parameter is set to #t, it doesn't do a
grab, it just does a tkwait:

   ;; 5. Set focus to the new window
    (set! stk::dialog-old-focus (get-focus))
    (focus w)
    (if grabbing (tkwait 'variable 'stk::button-pressed))
    (update)
    stk::button-pressed))

I use the dialog-box facility from a popup file select box which has
done a local grab to prevent the user from doing anything else in the
application untill the file select operation is completed. When the
dialog pops up, it doesn't see any events since the fileselect box
still has a "grab" in effect.

To fix this problem, I modified the dialog.stk file so that it saves
the current grab, does a local grab, then restores the previous grab
if there was one:

    ;; 5. Set focus to the new window
    (set! my-stk::dialog-old-focus (get-focus))
    (focus w)
    (if grabbing
        (begin
         (set! my-stk::dialog-old-grab (grab 'current *root*))
         (grab 'set w)
         (tkwait 'variable 'my-stk::button-pressed)
         (if (not (null? my-stk::dialog-old-grab))
             (grab my-stk::dialog-old-grab))))
    (update)
    my-stk::button-pressed))


The context diff between the 2.1.3 "dialog.stk" and my version is shown
below:


-------------------------dialog.stk context diff-------------------------
*** /usr/local/lib/stk/dialog.stk Tue Oct 11 16:58:38 1994
--- /home/reddwarf/grante/todo/dialog.stk Thu Dec 1 13:00:23 1994
***************
*** 23,28 ****
--- 23,29 ----
  (provide "dialog")
  
  (define stk::dialog-old-focus "none")
+ (define stk::dialog-old-grab ())
  (define stk::button-pressed #f)
  
  ;;
***************
*** 128,134 ****
      ;; 5. Set focus to the new window
      (set! stk::dialog-old-focus (get-focus))
      (focus w)
! (if grabbing (tkwait 'variable 'stk::button-pressed))
      (update)
      stk::button-pressed))
  
--- 129,141 ----
      ;; 5. Set focus to the new window
      (set! stk::dialog-old-focus (get-focus))
      (focus w)
! (if grabbing
! (begin
! (set! stk::dialog-old-grab (grab 'current *root*))
! (grab 'set w)
! (tkwait 'variable 'stk::button-pressed)
! (if (not (null? stk::dialog-old-grab))
! (grab stk::dialog-old-grab))))
      (update)
      stk::button-pressed))
  
-------------------------dialog.stk context diff-------------------------


-- 
Grant Edwards
Rosemount Inc.
grante_at_rosemount.com
Received on Thu Dec 01 1994 - 21:34:29 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST