<div dir="ltr"><div>I'm building a small text editing application based around an editor built with racket/gui and framework.. The idea is that it has the usual text editing features but also buttons where I select text and then based on which button I click on the selected text is manipulated in different ways. I'm just building the gui part now. I started using just racket/gui but then tried to implement some things in "framework" but I'm having trouble with a few things and I can't figure out how to do them from the documentation.</div>
<div><br></div><div>In the code below:</div><div>1) How do I add a "Save" feature to the file menu.</div><div>2) The "Open recent" menu item in the file menu opens my DrRacket "recently opened files". How do I get it to look at its own history instead of DrRackets.</div>
<div>3) Where I define main-frame as a frame:standard-menus% object in the code below, I tried to define it as a frame:editor% object but I couldn't get that to work. Could someone show me how to do that.</div><div><br>
</div><div>Thanks,</div><div>Harry</div><div>-------------------------------------</div><div>#lang racket/gui<br>(require framework)<br>(application:current-app-name "Sanskrit editor") <br><br>(define main-frame (new frame:standard-menus% [label "Sanskrit editor"]))<br>
<br>(send main-frame show #t)<br>(define main-area (send main-frame get-area-container))<br>(define h-panel (new horizontal-panel% [parent main-area][stretchable-height #f]))<br>(define msg (new message% [parent main-area][label "NO EVENTS SO FAR... "]))<br>
(define button-font (make-object font% 12 "Consolas" 'default 'normal 'bold ))<br>(define button-1 (new button% [parent h-panel][font button-font]<br> [label "Apply Sandhi"] <br>
; Callback procedure for a button click:<br> [callback (lambda (button event)<br> (send msg set-label "TEST Apply Sandhi Test"))]))<br><br>(define button-2 (new button% [parent h-panel][font button-font]<br>
[label "HK-->Unicode"]<br> ; [style '(border)]<br> ; Callback procedure for a button click:<br> [callback (lambda (button event)<br> (send msg set-label "TEST Converted HK-->Unicode"))]))<br>
<br><br>(define main-text-editor (new text%))<br><br>(define default-delta (make-object style-delta%) )<br>(send default-delta set-delta-face "Consolas")<br>(send default-delta set-size-add 4)<br>(send main-text-editor change-style default-delta)<br>
(send main-text-editor set-max-undo-history 400)<br>(send main-text-editor auto-wrap #t)<br><br>(define main-canvas (new editor-canvas% [parent main-area]))<br>(define WhiteSmokeColor (send the-color-database find-color "WhiteSmoke"))<br>
(send main-canvas set-canvas-background WhiteSmokeColor)<br>(send main-canvas set-editor main-text-editor)<br><br>--------------------------------------------------<br><br></div><div>
<p style="margin-bottom:0in"><br>
</p>
<p style="margin-bottom:0in"><br>
</p>
<p style="margin-bottom:0in"><br>
</p>
<p style="margin-bottom:0in"><br>
</p><br><br><br><br>.</div><div><br></div></div>