CalendarPane lib_Rect commands/functions

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

CalendarPane lib_Rect commands/functions

Post by newpie » Fri Jun 10, 2016 5:59 pm

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

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3211
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: CalendarPane lib_Rect commands/functions

Post by mwieder » Fri Jun 10, 2016 11:43 pm

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.

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: CalendarPane lib_Rect commands/functions

Post by newpie » Sat Jun 11, 2016 4:38 pm

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.

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: CalendarPane lib_Rect commands/functions

Post by Klaus » Sat Jun 11, 2016 4:51 pm

What is the value of -> theRect in your script?

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: CalendarPane lib_Rect commands/functions

Post by newpie » Sun Jun 12, 2016 4:32 pm

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

Klaus
Posts: 12204
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: CalendarPane lib_Rect commands/functions

Post by Klaus » Sun Jun 12, 2016 4:45 pm

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)?

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: CalendarPane lib_Rect commands/functions

Post by newpie » Mon Jun 13, 2016 2:52 am

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.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”