#lang racket/gui
;;;; RacketNote --- a notepad based on racket
;;;; Author: leesper
;;; definition of the RacketNoteGui
(define app-name " RacketNote")
(define version " v0.0.9")
(define app-label (string-append "*Untitled" app-name version))
(define window-width 600)
(define window-height 400)
(define editor (new text%))
(define racket-note-gui%
(class frame%
(define/public (clear-all)
(send editor select-all)
(send editor clear)
(send editor set-filename #f)
(send this refresh))
(define/augment (can-close?)
(ask-for-save? editor))
(define/public (ask-for-save? editor)
(if (send editor is-modified?)
(let ([res (message-box/custom "Save File" "Do you want to save this file ?"
"Yes" "No" "Cancel")])
(cond
[(= res 1) (send editor save-file
Racket 语言编写的一个简单记事本程序
最新推荐文章于 2024-09-18 12:19:09 发布
本文档展示了如何使用 Racket GUI 库创建一个简单的记事本程序,包括编辑器的定义、菜单系统、文件操作(新建、打开、保存、退出)以及编辑功能。用户可以进行文本编辑,并通过菜单进行文件管理和编辑操作。
摘要由CSDN通过智能技术生成