Simple geometry question

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TodayIsTheDay
Posts: 56
Joined: Sat Jun 20, 2009 2:41 pm

Simple geometry question

Post by TodayIsTheDay » Mon Sep 07, 2009 4:37 pm

I've got a colored stripe that goes across the top of a card. I want it to go from edge to edge no matter what size the screen...

In a smaller window it goes all the way from left side to right side.
If you resize the window it comes up short. (i.e- it seems to stay the same size)

I've tried the "scale selected object" but when you resize, it seems to make no difference...

Thanks!

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Simple geometry question

Post by jmburnod » Mon Sep 07, 2009 7:16 pm

Hi,

You can try this (if i unsertand what do you need. I speak french)

Code: Select all

on moveAnImg
   put 1000 into tTime
   put "myImage" into tNameImage
   put  (the width of this stack)-10 into tWs
   put 10 into tLeft
   put 10 into  tTop
   put tleft,tTop into depLoc
   put tWs,tTop into ArrLoc
   move img tNameImage from depLoc to ArrLoc in tTime milliseconds
end moveAnImg
All the best

Jean-Marc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 8:06 pm

Dear TodayIsTheDay,

Animations are always fun, but I don't think that's the solution this time. If I understand you correctly, you want the following:

Code: Select all

put the topleft of grc "Wide Line" into myTL
set the width of grc "Wide Line" to the width of this cd
set the topleft of grc "Wide Line" to myTL
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 07, 2009 8:18 pm

Hi todayistheday,
if you want the graphic or image to reszize with the stack then activate the object you want by selecting it and look in the property inspector for geometry. There you can "attach" the object so it resizes when the size of the card/stack is changed. Look in the user guide pdf for geomety manager.
What version of RunRev are you using?
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 8:24 pm

Please don't use the geometry manager. You will regret it.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

TodayIsTheDay
Posts: 56
Joined: Sat Jun 20, 2009 2:41 pm

Post by TodayIsTheDay » Mon Sep 07, 2009 8:31 pm

If I don't use the geometry settings how will I get all of the 27 cards in my program, some with many many text boxes, to resize correctly at runtime?

Would I have to code each card and item on that card?

I want to learn the best way to do things in RR... if it take a little longer but is better then maybe I should do it that way...

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 8:56 pm

Dear TodayIsTheDay,

If you use the GM for complex lay-outs with a lot of objects, the chance is very large that it will stop working at some point.

By composing your lay-out i a smart way, you can limit the number of objects that need to be moved or resized. Usually, I have only on group with a few fields that need adjustment after the window resizes. If possible, try to work with groups on multiple cards and use the same script to resize the objects in these groups. Try to keep things simple. That is pleasant for you as a programmer, but also for the user who needs to understand how the interface works.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 07, 2009 9:00 pm

hi,

Mark would this be ok in a stack script?

Code: Select all

on resizestack
   put the width of the current card into tWidth
   put the left of the current card into tLeft
   lock screen
   set the width of graphic "g1" of the current card to tWidth
   set the left of graphic "g1" of the current card to tLeft
   set the width of image "i1" of the current card to tWidth
   set the left of image "i1" of the current card to tLeft
   unlock screen
end resizestack
it works but do you see problems with the basic approach?
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 9:11 pm

Hi Bernd,

That should work, but I don't understand why you'd put the left of a card into a variable...?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 07, 2009 9:37 pm

Hi Mark,
thanks for confirming.
but I don't understand why you'd put the left of a card into a variable...?
it was just bad coding, I started out in a different direction and did not clean up. Now a cleaner version. Of cours this would fail if one would go to a card that has not a graphic or an image of that name. (One would test for the controls one wants to resize, or you make shure they are one each card. Or you put them into a group with background behavior turned on)

Code: Select all

on resizestack
   lock screen
   set the width of graphic "g1" to the width of this card
   set the left of graphic "g1" to the left of this card
   set the width of image "i1" to the width of this card
   set the left of image "i1" to the left of this card
   unlock screen
end resizestack
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 9:45 pm

Hi Bernd,

I still don't understand it. Why the left of the card? :-)

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 07, 2009 9:50 pm

Hi Mark,
I get it: you mean why I set the left of the image to the left of the card.
Well if I dont set the left of the image I will have an image of the width of the card that does not adjust its loc to the new loc. By setting the left after increasing the size of the image it is at the right place.
Is it that what you mean?
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 9:52 pm

Hi Bernd,

No. My question is: why don't you simply use 0 instead of the left of the card? OK, sorry, I couldn't resist to tease you a little.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 07, 2009 9:55 pm

OK,
You win,
Well I never really know whether it is the left on that side or on the other so I thought I let RunRev decide :)
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Mon Sep 07, 2009 10:22 pm

Anyway... that script should work fine. There are no problems with that. The problem is only that a general solution, such as the GM, eventually breaks. I think that a general solution is possible, as long as it isn't too ambitious and the GM is way too ambitious. I know this by experience.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply