Page 1 of 1

Geometry not working?

Posted: Wed Mar 04, 2015 10:06 pm
by jalz
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

Re: Geometry not working?

Posted: Wed Mar 04, 2015 10:37 pm
by dunbarx
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

Re: Geometry not working?

Posted: Thu Mar 05, 2015 12:15 am
by jalz
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 :)

Re: Geometry not working?

Posted: Thu Mar 05, 2015 8:17 am
by SparkOut
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.

Re: Geometry not working?

Posted: Thu Mar 05, 2015 8:51 pm
by jalz
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.

Re: Geometry not working?

Posted: Thu Mar 05, 2015 10:55 pm
by jalz
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

Re: Geometry not working?

Posted: Thu Mar 05, 2015 11:05 pm
by Klaus
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

Re: Geometry not working?

Posted: Thu Mar 05, 2015 11:39 pm
by jalz
Thanks Klaus - much appreciated