IDE hangs up

Jon jbondy at sover.net
Thu Jun 2 12:18:22 EDT 2005


Wow:

Thanks for your detailed help.  I know it took a lot of time, and I 
appreciate it.

:)

Jon


J. Landman Gay wrote:

> On 6/2/05 7:35 AM, Jon wrote:
>
>> Here is the contents of the script page for the main stack.  When I 
>> resize the stack, the IDE hangs up and has to be killed from the Task 
>> Manager.  <Ctrl>-"." and <Alt>-"." and like that there do nothing.  
>> Putting a breakpoint on the call to DoResizeStack does not prevent 
>> the hang. I assume something is getting called 
>> repeatedly/recursively, but with the debugger failing, I can't figure 
>> out what is going on.
>>
>> Any hints?
>
>
> There are a lot. ;) I'll comment your script:
>
>
> on resizeStack
>  DoResizeStack -- this is a command handler call, not a function
> end resizeStack
>
> Command handlers are written the way you have done it. Functions 
> generally return a value to the calling handler are are written in 
> this format:  put myFunction() into tResult. If there are values to be 
> passed to the function, you add them inside the parentheses: get 
> myFunction(val1,val2) into tResult. Note that functions must be called 
> with a place to put the returned value; i.e., my example uses the 
> varialbe tResult to store the returned value of the function call.
>
> Your command syntax is appropriate; you should not be using a function 
> here. So what needs to change is your handler syntax, like this:
>
> on DoResizeStack -- using "on" makes it a command handler
>  set left of "image" to 8
> -- here you have not told Rev what object to operate on. What is 
> "image"? You can refer to objects by name, ID, or number, but you need 
> to indicate what object should be manipulated. The line should be:
>
> set the left of img "imgName" to 8
>
> or you could use:
>
> set the left of img 1 to 8 -- OR:
> set the left of img ID 1005 to 8
>
> Any of these will work, but you do need to let Rev know what object 
> you are setting.
>
> The same applies for all lines in the script that use "set":
>  set the top of img "imgName" to 20
>  put the width of img "imageName" -16 into ww
>  put the height of img "imageName" - 32 into wh
>  put the formattedwidth of img "imageName" into fw
>  put the formattedheight of img "imageName" into fh
>  put fh / fw into iRatio
>  put h / w into wRatio
>  if iRatio > wRatio then
>    -- image is taller than space available: need empty space to right of
> image
>    set the height of img "imageName" to h
>    put h / iRatio into w
>    set the width of img "imageName" to w
>  else
>    -- need space under image
>    set the width of img "imageName" to w
>    put w * iRatio into h
>    set the height of img "imageName" to h
>  end if
> end DoResizeStack
>
> I have added "the" to all the properties referenced in the script, 
> that is, "the height", "the width". Technically this isn't necessary 
> but I find it to be good form.
>
> I am not sure why Rev would hang -- you should have seen  a syntax 
> error somewhere I think. But I suspect it didn't know what to do when 
> you called a command handler but wrote a function. Just a guess.
>


More information about the use-livecode mailing list