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

From: Jim Witte (jswitte_at_bloomington.in.us)
Date: Fri Nov 12 2004 - 00:05:50 PST


>> func(arg1, arg2, arg3)
>> begin
>> local Local1, local2, local3;
>> Arg1 := :LocalBox();
>> [..]
>>
>> Why is Arg1 an l-value for an assignment function? Why have it as a
>> parameter if it's going to immediately be replaced? And it's *called*
>> with a first parameter of :LocalBox() anyway from the
>> viewSetupChildrenScript, wasting a call to LocalBox!
>
> Is it Simon's code?
> Ask him! :)

   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,

Jim

-- 
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 - 06:00:02 PST