[plt-scheme] GUI guides?

From: Hugh Myers (hsmyers at gmail.com)
Date: Mon Jul 6 17:51:52 EDT 2009

When it comes to sizing an window/editor etc at least part of the
solution  is  the following:

  (send f resize 200 200)

Which will work quite nicely.

--hsm

On Mon, Jul 6, 2009 at 6:20 AM, Hugh Myers<hsmyers at gmail.com> wrote:
> Just noticed a slight hitch to such re-sizing.
>
> 1. no set-width or set-height
> 2. not even the old 'reposition-window' standby that is used mostly to
> resize a window and only sometimes to actually move the silly thing.
>
> Since such things are required, under what name would I find them?
>
> --hsm
>
> On Mon, Jul 6, 2009 at 6:11 AM, Hugh Myers<hsmyers at gmail.com> wrote:
>> Printing will be done in postscript where such information isn't
>> needed. Not quite sure why I'd want to play with a print dc but
>> obviously if I were going to I'd use the correct source. Not sure why
>> I'd use globals either--- what I need can be computed at point of need
>> just fine. Width of full line of text in a chess board remains
>> constant so only needs to be computed just before showing the window.
>>
>> --hsm
>>
>>
>>
>> On Mon, Jul 6, 2009 at 6:03 AM, Robby
>> Findler<robby at eecs.northwestern.edu> wrote:
>>> That's a fine way to sizing the window, but if you want to print the
>>> window, that sizing information will be wrong.
>>>
>>> Generally, you want to abstract over the dc for all drawing (maybe
>>> you've done that already) and then just pass in the appropriate that
>>> you get from the system (usually from the get-dc method of a canvas%,
>>> the on-paint method of editor<%> or the print method of an editor<%>).
>>> Just be careful you don't use a global values that are computed from
>>> the wrong dc.
>>>
>>> Robby
>>>
>>> On Mon, Jul 6, 2009 at 6:55 AM, Hugh Myers<hsmyers at gmail.com> wrote:
>>>> Good point. Are you saying this is the wrong approach to correctly
>>>> sizing a window displaying a chess font? If so what would you
>>>> recommend?
>>>>
>>>> --hsm
>>>>
>>>>
>>>> On Sun, Jul 5, 2009 at 10:00 PM, Hugh Myers<hsmyers at gmail.com> wrote:
>>>>> The key to width of text is:
>>>>>
>>>>>> (define dc (send c get-dc))
>>>>>> (send dc get-text-extent "123456787" (make-object font% 24 "Chess Adventurer" 'symbol))
>>>>>
>>>>> 264.0
>>>>> 32.0
>>>>> 0.0
>>>>> 0.0
>>>>>
>>>>> This while the dc in question exists...
>>>>>
>>>>> --hsm
>>>>>
>>>>> On Sun, Jul 5, 2009 at 9:12 PM, Hugh Myers<hsmyers at gmail.com> wrote:
>>>>>> Added to list:
>>>>>>
>>>>>> Care and feeding of Status Line---a subject worth a guide in of itself:
>>>>>>
>>>>>> Create a status line
>>>>>> Open a status line
>>>>>> Write to a status line
>>>>>> Close a status line
>>>>>> Remove a status line
>>>>>>
>>>>>> Note that the overall status line is partitioned into writable areas.
>>>>>> For instance for a chess board, I would want to show the move text,
>>>>>> the move number and the move ply (move number without regard to color;
>>>>>> ply 1 is move 1 as is ply 2 [white's move followed by black's move
>>>>>> etc.]). Perhaps also information on castling, draw information etc. An
>>>>>> example rich environment.
>>>>>>
>>>>>> --hsm
>>>>>>
>>>>>> On Sun, Jul 5, 2009 at 8:41 PM, Hugh Myers<hsmyers at gmail.com> wrote:
>>>>>>> Thanks for the pointer to dc% What you mention seems like a logical
>>>>>>> (heaven forbid) arrangement given the concepts involved. Having
>>>>>>> survived the age of roll-your-own gui (usually text), original
>>>>>>> windows, and then MFC this should be just another notch in my
>>>>>>> gui-belt. Even as we e-speak I'm in the middle of investigating frame%
>>>>>>> which has some of the answers in my shopping-list. I think one of the
>>>>>>> things that will be in my version of 'GUI Editor Guide' will be a list
>>>>>>> of what all can be set/modified for a given window. Sometimes it is
>>>>>>> easier to pick and choose from such a list than to comb a detailed
>>>>>>> reference--- I think as a guide, this approach might be the one to go
>>>>>>> with.
>>>>>>>
>>>>>>> --hsm
>>>>>>>
>>>>>>> On Sun, Jul 5, 2009 at 6:51 PM, Ryan Culpepper<ryanc at ccs.neu.edu> wrote:
>>>>>>>> Hugh Myers wrote:
>>>>>>>>>
>>>>>>>>> Am solving some of these as I try and think of questions to ask. Some
>>>>>>>>> of the answers raise questions about what is or isn't do-able. For
>>>>>>>>> instance given fixed width symbol font (like all chess fonts) it would
>>>>>>>>> be nice to ask how wide and how tall a given text string is. This
>>>>>>>>> could be used to 'size' the window before display. Nothing I've seen
>>>>>>>>> yet even hints that this is possible, yet it seems quit reasonable.
>>>>>>>>
>>>>>>>> I think you want 'get-text-extent' in 'dc<%>' (drawing context).
>>>>>>>>
>>>>>>>> Here are some rough guidelines:
>>>>>>>>
>>>>>>>>  - 'editor<%>' and 'text%' deal with the text, its styles, modifications to
>>>>>>>> the text, high-level display concerns (word wrapping, visible/ region, etc).
>>>>>>>>
>>>>>>>>  - 'canvas<%>' and 'editor-canvas%' deal with the gui concerns: dimensions
>>>>>>>> of the editor widget, its auxiliary gui elements (scrollbars), etc.
>>>>>>>>
>>>>>>>>  - 'dc<%>' deals with rendering issues, like how big a string in a
>>>>>>>> particular font will be rendered on screen.
>>>>>>>>
>>>>>>>> Browsing those classes and interfaces is a good way to get an idea of what
>>>>>>>> functionality is available and how it's provided. Remember to look at the
>>>>>>>> superclasses and superinterfaces, too.
>>>>>>>>
>>>>>>>> Ryan
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>> _________________________________________________
>>>>  For list-related administrative tasks:
>>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>>
>>>
>>
>


Posted on the users mailing list.