card rect problem

Peter Brigham pmbrig at
Thu Oct 26 00:12:17 EDT 2006

I have a problem that's driving me crazy. I'm working on OSX 10.4 on  
an iBook G4 with Dreamcard 2.6.1, and I run this particular stack  
system under the IDE exclusively. It's a stack for printing clinical  
notes, but it has lots of bells & whistles. I have a substack for  
printing a formatted letter, with some header fields and a main text  
field. The user opens the substack with a button, the main field is  
loaded with the date, addressee, etc, and is set to scrolling style,  
then the user types the letter, then clicks a print button to print  
the letter (the letter content gets saved as a custom property of the  
originating card). A set of handlers then resets the style of the  
field to opaque and expands it vertically along with the stack window  
to page-size, prints the first page with the headers, then expands  
the text field to full page size (covering the headers), and scrolls  
the text repeatedly by the proper amount to print the subsequent pages.

I kept having problems with the print output -- the text field was  
apparently not expanding to full page size and only the top 25 lines  
were being printed. I traced the problem down to this: after I expand  
the stack rect to full page size and expand the text field to fit the  
new window size, the height of the stack is 830 as it should be but  
the height of the card is 676, thus cutting off the lower part of the  
field from printing when I print the card. The weird thing is that it  
happens some of the time but not all the time. At one point I thought  
I could get it to work properly by setting a breakpoint -- every time  
I ran it without interrupting the script it failed, and every time I  
stopped it with a breakpoint to try to debug it by stepping through  
the script it worked fine. Then it stopped working even with the  
breakpoint. I put in a "hard" breakpoint --

if cardHeight <> stackHeight then
end if

in the script right after where I reset the size of the window and  
the field, and it gets triggered! I can't figure out what could make  
the card height different from the stack height. I can't set the  
height of the card to fix it. Now it seems to work occasionally but  
mostly not, with no pattern I can see.

Does it have to do with stuff I don't understand about setting the  
rect of a stack vs the rect of a window? I sure don't seem to get  
something important about the window size vs the card size. What  
could be making the card rect be different from the window rect? And  
why would this be intermittent? I'm getting pretty frantic, since as  
it stands I can't even print my clinical notes properly now and it's  
seriously interfering with me managing my practice....

-- Peter Brigham

Peter M. Brigham, MD
pmbrig at

Networks create communities.

More information about the Use-livecode mailing list