[plt-scheme] GUI guides?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Jul 6 07:48:26 EDT 2009

One thing to not about dc's is that different dcs give different sizes
for the same text. The dc you've used below is a canvas-dc% object, ie
one for drawing on the screen. It will be the same as a bitmap-dc%.
But a post-script-dc% and a printer-dc% will give different answers.

Robby

On Sun, Jul 5, 2009 at 11: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.