Re: [NTLK] [PROG] Getting a protoPicker to display - makePickLine and LocalBox()

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Mon Nov 22 2004 - 05:56:53 PST


Aux environs du 12/11/04 à 3:05 -0500, sous le titre "Re: [NTLK]
[PROG] Getting a protoPicker to display - ma", Jim Witte prit sa plus
belle plume pour écrire les mots suivants:
> Nope. That's directly from the magic pointer:
>
>DefineGlobalConstant('kRef9CB, // @626
>{
>[..] MakePickLine: func(|X:Prism1|, |X:Prism2|, |X:Prism3|)
> begin
> local |Y:Prism1|, |Y:Prism2|, |Y:Prism3|;
> |X:Prism1| := :LocalBox(); // **
> if not indent then
> (indent := StrFontWidth(label, labelFont) + 6);
> |Y:Prism1| := FontHeight(labelFont);
> |Y:Prism2| := (|X:Prism1|.bottom - |Y:Prism1|) >> 1 +
>FontAscent(labelFont);
> |Y:Prism3| := (|X:Prism1|.bottom -
>FontHeight(entryFont)) >> 1 +
>FontAscent(entryFont);
> pix := [{font: labelFont}, MakeText(|X:Prism2|,
>|X:Prism1|.left,
>|X:Prism1|.top, |X:Prism1|.left + indent, |X:Prism1|.top + |Y:Prism2|),
>{font: entryFont}, MakeText(|X:Prism3|, |X:Prism1|.left + indent,
>|X:Prism1|.top, |X:Prism1|.right, |X:Prism1|.top + |Y:Prism3|)]
> end,
> viewSetupChildrenScript: func()
> begin
> :MakePickLine(:LocalBox(), label, :TextSetup()) // ***
> end,

It's more complex than what you may think: both MakePickLine and
viewSetupChildrenScript could be redefined in a derived object.

DefConst('kObject,
{
...
        foo: func(arg)
        begin
                // do nothing with arg
        end,
        foobar: func()
        begin
                :foo(:LocalBox());
        end,
});

makes sense because you could have (elsewhere):
{
        _proto: kObject,
        foo: func(arg)
        begin
                // do something with arg
        end,
}

and:
{
        _proto: kObject,
        foobar: func(arg)
        begin
                :foo(nil);
        end,
}

Paul

-- 
Ministre plénipotentiaire en disponibilité.
Baignoire à vendre.
http://www.kallisys.com/
http://newton.kallisys.net:8080/
-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Mon Nov 22 2004 - 07:00:06 PST