Script to find bottom of lowest field

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Script to find bottom of lowest field

Monte Goulding via use-livecode
Hi script wizards!

I have a card containing a number of fields. I want to add another field, but position this new field to have its top 20 pixels lower than the bottom of any of the existing fields.

Does anyone already have a magic script to do this?

I also want to learn something new!

Peter Bogdanoff
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Script to find bottom of lowest field

Monte Goulding via use-livecode
on mouseUp
  put 20+maxbottom()
end mouseUp

-- note: invisible or hidden fields are included
function maxbottom
  repeat with i=1 to the num of fields of this card
    put the bottom of fld i of this card into b[i]
  end repeat
  return max(b)
end maxbottom


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Script to find bottom of lowest field

Monte Goulding via use-livecode
In reply to this post by Monte Goulding via use-livecode
Not tested:

Put -99999 into tMax
Repeat with I = 1 to the number of fields of this card
 Put the max (tmax,the bottom of field I) into tMax
End repeat

Create field
Put it into tField
Set the top tField to tMax + 20

Ralph DiMola
IT Director
Evergreen Information Services
[hidden email]


-----Original Message-----
From: use-livecode [mailto:[hidden email]] On Behalf
Of Peter Bogdanoff via use-livecode
Sent: Monday, April 03, 2017 5:34 PM
To: How to use LiveCode
Cc: Peter Bogdanoff
Subject: Script to find bottom of lowest field

Hi script wizards!

I have a card containing a number of fields. I want to add another field,
but position this new field to have its top 20 pixels lower than the bottom
of any of the existing fields.

Does anyone already have a magic script to do this?

I also want to learn something new!

Peter Bogdanoff
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Script to find bottom of lowest field

Monte Goulding via use-livecode
A sneakier way would be to select all, group them, then get the bottom of the group, then ungroup them again. Account for group margins (2 or 3 pixels or something). If there are other objects of course that won't help you.

Bob S


> On Apr 3, 2017, at 15:02 , Ralph DiMola via use-livecode <[hidden email]> wrote:
>
> Put -99999 into tMax
> Repeat with I = 1 to the number of fields of this card
> Put the max (tmax,the bottom of field I) into tMax
> End repeat
>
> Create field
> Put it into tField
> Set the top tField to tMax + 20
>
> Ralph DiMola


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Script to find bottom of lowest field

Monte Goulding via use-livecode
In reply to this post by Monte Goulding via use-livecode
Yes, max and an array.

Thanks Hermann!!

On Apr 3, 2017, at 2:58 PM, hh via use-livecode <[hidden email]> wrote:

> on mouseUp
>  put 20+maxbottom()
> end mouseUp
>
> -- note: invisible or hidden fields are included
> function maxbottom
>  repeat with i=1 to the num of fields of this card
>    put the bottom of fld i of this card into b[i]
>  end repeat
>  return max(b)
> end maxbottom
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...