Changing the size properties of a stack, moves its location

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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

trevix
Posts: 389
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Changing the size properties of a stack, moves its location

Post by trevix » Mon Mar 19, 2018 6:32 pm

See message above:
Sorry Klaus, I may not have explained my self:.......
..
What I got instead, is that after reducing the width of the stack, the two rect controls are not in the middle anymore. Don't tell me that i can move them to center, because I know.
Trevix

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

Re: Changing the size properties of a stack, moves its location

Post by Klaus » Mon Mar 19, 2018 6:52 pm

trevix wrote:
Mon Mar 19, 2018 6:32 pm
...
What I got instead, is that after reducing the width of the stack, the two rect controls are not in the middle anymore.
This is correct behavior!
trevix wrote:
Mon Mar 19, 2018 6:32 pm
...
Don't tell me that i can move them to center, because I know.
I already gave you an answer: http://forums.livecode.com/viewtopic.ph ... 65#p165159
This CANNOT be done without any scripting. 8)

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

Re: Changing the size properties of a stack, moves its location

Post by Klaus » Mon Mar 19, 2018 7:06 pm

Looks like this is appropriate here:
Don't shoot the messenger! 8)

bogs
Posts: 2276
Joined: Sat Feb 25, 2017 10:45 pm

Re: Changing the size properties of a stack, moves its location

Post by bogs » Mon Mar 19, 2018 7:11 pm

Image Dang, I MISSED!

Oh, you said "DON'T shoot!" :oops:
Image

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1780
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Changing the size properties of a stack, moves its location

Post by [-hh] » Tue Mar 20, 2018 7:58 am

@all
Probably trevix has changed the scalefactor of the stack?
If that is not 1.0 then changing the size needs its own computations for setting the loc of the stack window.
That's the only possibility I can imagine that Klaus' script doesn't work as expected.

@trevix
You confuse the window of a stack with the controls of the stack. These are different objects.
shiftLock happens

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 311
Joined: Mon Jun 10, 2013 1:32 pm

Re: Changing the size properties of a stack, moves its location

Post by Lagi Pittas » Tue Mar 20, 2018 4:07 pm

Hi

If I read this right I think the OP wants it animated like "visual Effect Zoom Out" when going to a new card - I could be wrong but here is what I came up with - straight from fingers to code so if there are better ways to do this please pipe in.

Code: Select all


-- In Place Animated stack resize/expand  
on mouseUp 
   local lnLoc, lnW, lnH
   constant kMaxWidth = 500
   constant  kMaxHeight = 500
   
   put the width of this stack into lnW
   put the height of this stack into lnH
   put the loc of this stack into lnLoc
   repeat forever
      add 2 to lnW -- Change the number for different speeds
      add 2 to lnH
      
        -- We don't want increase the height or Width greater asked for if they are different start and end sizes
      put  Min(lnW,kMaxWidth) into lnW
      put Min(lnH,kMaxHeight) into lnH
      
      set the width of this stack to lnW
      set the height of this stack to lnH
      set the loc of this stack to lnLoc
      
      if (lnW >= kMaxWidth) AND (lnH >= kMaxHeight) then
         exit repeat
      end if
      unlock screen
      -- This has different effects on expand and squish routine in the stack - play with the number of milliseconds
      wait 0 with messages
   end repeat
end mouseUp
 
The stack include a "squish" routine that makes it shrink to the centre.
resizedynamic.zip
(1.13 KiB) Downloaded 18 times
The only problem I had was when I had the wait with messages (to get out of a loop or adjust the speed) it would not animate but delay and show the maximum size so I had to put the

Code: Select all

 unlock screen
instruction there

I presume that is an internal LC design to speed the script up, but I'd like to know when that kicks in and when does it decide to update the screen? - over to you Hermann ;-)

Regards Lagi

bogs
Posts: 2276
Joined: Sat Feb 25, 2017 10:45 pm

Re: Changing the size properties of a stack, moves its location

Post by bogs » Tue Mar 20, 2018 4:58 pm

That is pretty creative Lagi. I think -hh might be right though, either that or all of us are not understanding and trevix will just have to come up with a clearer explanation possibly. From all the posts he put down, I figured Klaus was dead on.
Image

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

Re: Changing the size properties of a stack, moves its location

Post by Klaus » Tue Mar 20, 2018 6:09 pm

I'm not dead, I just smell funny! :D

bogs
Posts: 2276
Joined: Sat Feb 25, 2017 10:45 pm

Re: Changing the size properties of a stack, moves its location

Post by bogs » Tue Mar 20, 2018 7:19 pm

Ah HAH! I thought that was the Limburger! :mrgreen:
Image

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

Re: Changing the size properties of a stack, moves its location

Post by Klaus » Tue Mar 20, 2018 7:27 pm

Yep, that one, too! :-)

bogs
Posts: 2276
Joined: Sat Feb 25, 2017 10:45 pm

Re: Changing the size properties of a stack, moves its location

Post by bogs » Tue Mar 20, 2018 8:35 pm

We're terrible :twisted:
You cannot make another post so soon after your last.
<sigh> Since my last one was in a completely different topic, and I am obviously not moving as fast as a 'bot' might, I would suspect the timer needs some adjusting eh.
Image

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”