racket / racket/racket

feature request: the state of a viewport (open, hidden or closed)

Open
#5,545 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

Would it be possible to add a procedure to library graphics/graphics showing the state of a viewport (open, hidden or closed)? When closing a viewport in the title bar (upper right corner) while the program is waiting for a mouse-click or a key-press, the program keeps waiting without warning and doing nothing. When a viewport has been closed no such event can be posted. Just issuing a warning when closing a viewport would do as well. The following program not halt after the user has closed the viewport and confirmed so in the message box:

(require graphics/graphics  racket/gui)

(open-graphics)

(define vp (open-viewport "close me" 100 100))

(let loop ()
  (unless
    (eq? (message-box "Question" "Did you close the viewport?" #f '(yes-no)) 'yes)
    (loop)))

(get-mouse-click vp)

It was the first time using graphics in Racket. I have looked into "https://docs.racket-lang.org/gui/index.html". I do like the callback facilities, but find it quite complicated. I want full control over the locations of buttons. My program is at "https://github.com/joskoot/hanoi".

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the graphics/graphics library and the Racket GUI documentation, then reproduce the example with get-mouse-click and a viewport closed from its title bar. Trace how viewport closure is represented while input is pending. Done means a closed viewport can be detected or the waiting operation clearly warns or exits instead of hanging.

Written by the indexing model from the issue text.

Assessment

Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.