<div dir="ltr"><div>Thanks Robby,<br></div><div>When I use (define main-frame (new frame:text%)) case 1 below it gives me save, save all, print etc. in the file menu but now:</div><div>a) the panel with the buttons I define is at the bottom not the top.</div>
<div>b) I can't figure out how to modify the initial editor characteristics when the application starts (different font, different size etc.) or the editor-canvas% characteristics (different background) as I was able to when I used (define main-frame (new frame:standard-menus%))</div>
<div>c) I can't figure out how to now apply set-max-undo-history so I can use the undo feature.</div><div><br></div><div><br></div><div>How do I get the horizontal-panel with my buttons to display at the top ?</div><div>
How do I access and set the characteristics of the editor% and the editor-canvas% ?</div><div>How do I set se-max-undo-history ?</div><div><br></div><div>CASE 1 using (define main-frame (new frame:text%)) Menus OK but issues stated above.</div>
<div>----------------------------------------------------------------------------------------</div><div>#lang racket/gui<br>(require framework)<br>(application:current-app-name "Sanskrit editor") ;;framework<br>
(define main-frame (new frame:text% ))<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][alignment '(left top)]))<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>
<br> ; Callback procedure for a button click:<br> [callback (lambda (button event)<br> (send msg set-label "TEST Converted HK-->Unicode"))]))</div>
<div><br></div><div>CASE 2 using (define main-frame (new frame:text% )) The panel with my buttons is correctly placed at top and I can change editor% and editor-canvas% properties but no "save" and "save all" and "new" doesn't work correctly in "file" menu.</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<br>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>
; 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 6)<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></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 4, 2014 at 5:41 AM, Robby Findler <span dir="ltr"><<a href="mailto:robby@eecs.northwestern.edu" target="_blank">robby@eecs.northwestern.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think you want this for main-frame:<div><br></div><div>(define main-frame (new frame:text%))<br></div>
<div><br></div><div>But for the other, it looks not so simple. The framework isn't abstracted out in the right ways to have two different lists of recently opened files. It probably should be, tho. Patches welcome! :)</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>Robby</div></font></span></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Feb 4, 2014 at 1:25 AM, Harry Spier <span dir="ltr"><<a href="mailto:vasishtha.spier@gmail.com" target="_blank">vasishtha.spier@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>A clarification about point 1 below: If I open a file or select "new" in the file menu it creates a new window and I'm able to save the text from that new window. Its just when I run the program and type text into the visible frame of the original window that there are no "save","save as","print" etc. menu items in the file menu.<br>
</div><div><br></div><div>Thanks,</div><div>Harry</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 3, 2014 at 11:00 PM, Harry Spier <span dir="ltr"><<a href="mailto:vasishtha.spier@gmail.com" target="_blank">vasishtha.spier@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>
</blockquote></div><br></div>
</div></div><br></div></div><div class="im">____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div><br></div>