Problem resizing a stack

Peter Haworth pete at lcsql.com
Mon Aug 27 19:55:00 EDT 2012


I'm strongly thinking that preOpenCard is a suspect area for plugins.

My stack resizes correctly if I send a message to the handler that does the
resizing from the message box after the stack is displayed but the same
handler does nothing when executed in preOpencard, even when the code is to
send the message in zero milliseconds.

Furthermore, after finally getting a breakpoint to work in preOpenCard, I
have seen three totally different results in a field which is populated in
preOpenCard.

If I step though all the code a line at a time, the filed is populated as
expected.

If, at the breakpoint, I click the green arrow to continue executing
without any more stepping, I get an incorrect display in the field.

If I remove the breakpoint, the field is empty.

All of this works perfectly fine when the stack is not a plugin, whether I
run it as toplevel or modeless.

It appears that something about preOpenCard processing is different when a
stack is a plugin than when it isn't.

Any clues?

Pete
lcSQL Software <http://www.lcsql.com>



On Mon, Aug 27, 2012 at 3:36 PM, Peter Haworth <pete at lcsql.com> wrote:

> Well I thought I had this problem licked but as usual, LC manages to
> provide some last minute surprises.
>
> The stack in question is destined to be a modeless plugin.  I've been
> doing 90% of my testing with it as a regular toplevel stack, not a plugin
> and the fix for this problem (locking/unlocking messages around the stack
> resize) worked fine.
>
> Today I ran it as a modeless plugin and all is messed up again.  Not only
> does the stack not resize correctly, but the group that I am attempting to
> show only randomly shows up.  To make matters worse, attempts to debug fail
> because neither a debug breakpoint nor a breakpoint command cause it to
> break (the code is in a preOpenCard handler).
>
>
> Pete
> lcSQL Software <http://www.lcsql.com>
>
>
>
> On Fri, Aug 24, 2012 at 5:01 PM, <dunbarx at aol.com> wrote:
>
>> It has become standard practice to:
>>
>>
>> send yourMessage in 0 millisec
>>
>>
>> instead of
>>
>>
>> just put some code after openCard/openStack,etc types of handlers. I hate
>> that this might be so, but it seems to account, or at least forgive,
>> certain timing and event queue issues that are inherent in those types of
>> messages.
>>
>>
>> Try it. I don't think there is a formal methodology for it all, it just
>> seems to work. The fact that you can step through code, but not execute in
>> real time, makes me think it could solve the problem.
>>
>>
>> Craig Newman
>>
>>
>>
>> -----Original Message-----
>> From: Peter Haworth <pete at lcsql.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Sent: Fri, Aug 24, 2012 6:09 pm
>> Subject: Problem resizing a stack
>>
>>
>> A stack I'm working on has a group at the bottom that, at startup, needs
>> to
>> be hiddenor visible depending on preference setting.
>>
>> I want to adjust the bottom of the stack depdning on whether the group is
>> hidden or not.
>>
>> In a preOpenCard handler, if  the preference requires the group to be
>> hidden and it is not already hidden, I get the stack's rectangle, subtract
>> the height of the group from item 4 of the rectangle, then set the stack's
>> rectangle to the new value.
>>
>> When I step through the code that does this in debug, the stack height
>> changes correctly, but when the code is executed without a debug
>> breakpoint, the bottom of the stack doesn't change position.
>>
>> Is there some timing issue I need to be aware of when changing stack sizes
>> like this?
>>
>> Pete
>> lcSQL Software <http://www.lcsql.com>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>



More information about the use-livecode mailing list