Page 1 of 1

CalendarPane lib_Rect commands/functions

Posted: Fri Jun 10, 2016 5:59 pm
by newpie
Hello, I am sure I am missing something, but I can't get these functions or commands to work on the CalendarPane that I created. Thanks for any help.

Download Link: http://www.rotundasoftware.com/livecode ... arPane.php

Code: Select all

   dispatch function "rt_Height( theRect )" to group "CalendarPane"
   dispatch "rt_MoveTo @theRect" to group "CalendarPane" with "150", "118"
It says "unhandled" which means no matching handlers were found. I tried putting the function/commands in multiple locations in my stack as well.


Here is the excerpt from lib_Rect stack:
lib_Rect v.09
By David Beck

INSTRUCTIONS FOR USE

Make sure to add lib_Rect to your project and to execute the command:

start using stack "lib_Rect"

The you can use the following functions and commands:

rt_Left( theRect ) -- return left side of theRect
rt_Top( theRect ) -- return top side of theRect
rt_Right( theRect ) -- return right side of theRect
rt_Bottom( theRect ) -- return bottom side of theRect
rt_Width( theRect ) -- return width of theRect
rt_Height( theRect ) -- return height of theRect

rt_Make( theLeft, theTop, theRight, theBottom ) -- return "theLeft,theTop,theRight,theBottom"
rt_IsValid( theRect ) -- return true iff the rect has a non-negative width and height
rt_MoveTo @theRect, newLeft, newTop -- move theRect to newLeft, newTop
rt_Offset @theRect, deltaX, deltaY -- offset theRect by deltaX, deltaY
rt_Grow @theRect, growBy

rt_Intersection( rectA, rectB )
rt_Union( rectA, rectB )

rt_AlignAToB @rectA, rectB, direction -- align the center of rectA to the center of rectB
rt_AWouldFitInB( rectA, rectB )
rt_MoveAToBeWithinB @rectA, rectB

Re: CalendarPane lib_Rect commands/functions

Posted: Fri Jun 10, 2016 11:43 pm
by mwieder
First off, if you "start using" lib_Rect then dispatching functions and commands to a group won't work because they aren't in the group.
Try

Code: Select all

dispatch function "rt_Height" with theRect
although you then have to decide what to do with the returned value
and

Code: Select all

dispatch "rt_MoveTo" with @theRect, 150, 118
However, since the functions you want to use are already in a library in use, I don't see an advantage in using dispatch:

Code: Select all

get rt_Height(theRect)
rt_MoveTo @theRect, 150, 118
should do the trick for you.

Re: CalendarPane lib_Rect commands/functions

Posted: Sat Jun 11, 2016 4:38 pm
by newpie
Thanks for helping mwieder. I did try as you suggested and got an error:
stack "testCalendar": execution error at line 30 (Operators -: error in right operand), char 1
from this function:

Code: Select all

function rt_Width theRect
   return item 3 of theRect - item 1 of theRect
end rt_Width
Not sure what might be occurring.

Re: CalendarPane lib_Rect commands/functions

Posted: Sat Jun 11, 2016 4:51 pm
by Klaus
What is the value of -> theRect in your script?

Re: CalendarPane lib_Rect commands/functions

Posted: Sun Jun 12, 2016 4:32 pm
by newpie
Hey Klaus, it is giving me the value of "theRect" which seems to be the issue I imagine.
On startup I do:

Code: Select all

   start using stack "lib_Rect"
   start using stack "lib_CalendarPane"
Thanks for any help

Re: CalendarPane lib_Rect commands/functions

Posted: Sun Jun 12, 2016 4:45 pm
by Klaus
newpie wrote:Hey Klaus, it is giving me the value of "theRect" which seems to be the issue I imagine.
:shock: :shock: :shock:
You know that you need to supply a VALID rect (= 4 numbers separated by COMMA)?

Re: CalendarPane lib_Rect commands/functions

Posted: Mon Jun 13, 2016 2:52 am
by newpie
Thank you for replying. I thought the value of the Rect was supplied by the calendar pane stacks. I will try to study this further when I have time.