Geometry not working?

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
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Geometry not working?

Post by jalz » Wed Mar 04, 2015 10:06 pm

Hi Guys,

I've got an unusual situation with the Geometry of an object. I've got a datagrid in my app and I want to "anchor" the bottom of the datagrid to about a cm off the bottom of the card so if the user enlarges the card, the datagrid would extend or contract depending on the depth of the card. So I highlighted the datagrid went over to the Geometry palette, selected the scale selected object and clicked on the bottom and right red bars. When I resize the card, the datagrid remains fixed in size. Anyway I've tried othe combinations to get my datagrid scaling according to the card size but not having much luck.

I then decided to test this feature out on a new main stack, dragged a datagrid across and applied the geometry settings I applied to my real app. This time it worked exactly the way I want. So went back over to my real stack and tried to reapply the same behaviour and the datagrid just doesn't scale.

I'm confused, why would one work and the other not, seems a little inconsistent behaviour. I know its difficult to suggest why it could not be working without looking at the stack, but has anyone come across this? My main app has lots more objects on including a couple of data grids fields, labels etc, but that should not make a difference should it?

Best

Jalz

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6627
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Geometry not working?

Post by dunbarx » Wed Mar 04, 2015 10:37 pm

Hi.

There is only one thing more mysterious than a dataGrid, and that is the geometry manager. I will not go so far to say that it is possessed, but I have heard strange noises at night in its vicinity.

Why not just set the botright of the group to the botRight of the card, minus a few pixels? You have to manage this just a little, but only a little.

Craig Newman

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Geometry not working?

Post by jalz » Thu Mar 05, 2015 12:15 am

Hi Craig
Lol - both of the things I've tried to get my head around :shock: ……

Your idea of set the botright of the group to the botRight of the card is something that didn't even occur to me. Was looking for the easy way out with the Geometry manager. I've got your suggestion working along with the resizeStack handler. Shame geometry is buggy, would have liked to use the clicky tools when I can :)

SparkOut
Posts: 2167
Joined: Sun Sep 23, 2007 4:58 pm

Re: Geometry not working?

Post by SparkOut » Thu Mar 05, 2015 8:17 am

Just a thought, if you still have your test stack. If you add a second data grid does it still work correctly? And if you set some geometry on the new grid too? I'm wondering if the GM is getting confused because of the multiple references to a datagrid group.

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Geometry not working?

Post by jalz » Thu Mar 05, 2015 8:51 pm

Hi Sparkout,

I created a brand new main stack just to try it out as was intrigued. I placed 3 data grids, 2 fields, 3 option boxes, a label and locked right and bottom of the objects. All scale exactly as I would have expected. Tried applying geometry on the datagrid in my app and it fails. My app has lots of objects so it could be anything that could be preventing the correct behaviour.

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Geometry not working?

Post by jalz » Thu Mar 05, 2015 10:55 pm

Hi,
I have another issue I need some advice on regarding these objects expanding and contracting dependant on card height. I've got a coloured rectangle on my card and I want to basically stretch the rectangle so it fits the height of the card. I've got the following code which I thought would have sorted me but I can either lock to the top of the page or the bottom of the page, can't seem to lock both so the rectangle grows.

Code: Select all

on resizeStack
   --set the lockLocation of graphic "Rectangle" to true
   set the top of graphic "Rectangle" to the top of this card
   set the bottom of graphic "Rectangle" to the bottom of this card
end resizeStack

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

Re: Geometry not working?

Post by Klaus » Thu Mar 05, 2015 11:05 pm

Hi Jalz,

well, setting the left, top, right or bottom of an object does not change its dimension, just its location!

Do something like this by setting the rect of your graphic and note the handy parameters that come with "resizestack" :D

Code: Select all

on resizeStack newWidth,newHeight,oldWidth,oldHeight
  lock screen
  put the rect of graphic "Rectangle" into tRect
  put 0 into item 2 of tRect
  put newHeight into item 4 of tRect
  set the rect of graphic "Rectangle" to tRect
  unlock screen
end resizestack
Best

Klaus

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Geometry not working?

Post by jalz » Thu Mar 05, 2015 11:39 pm

Thanks Klaus - much appreciated

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”