Controlling grouped objects
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Controlling grouped objects
Hi Guys,
On a roll now, things seem to be finally falling into place. I do have another query, its more to do with efficiencies of grouped objects.
I have a two fields laid out next to each other aligned top with both the heights set to 21 (indicating a single line). The fields are called description and price. I have placed a solid rectangle around both fields. I have then grouped all three objects together and called it myPriceRow.
The question is the description field may contain x number of lines and I want the field to autoresize to display all the content of the field. So checking out the dictionary I came across the formattedheight command. I figured out that I can obtain the formattedheight of the content within the description field and then set the height of the description field so that its slightly greater than the formatted height of the content. This seemed to work fine, however two things I noted as issues.
1) When I set the height of the description field, the field increases in size from the centre outward, making description and price aligned in the centre rather than the top. Is there a way I can lock the top location before I set the height of description, so it grows downward? If not I will just have to get the top location of description before its grown and then readjust the alignment of the fields afterwards.
2) The second thing was, the solid rectangle which was around the fields needs to grow as well depending on the description field size. I can manually set the height of the rectangle object so it’s the formattedheight +10. However because I’ve grouped the items together, can I somehow use the groups properties to extend the description field and the solid rectangle in one line of code?
Both of the these things above I can do manually, I was mainly querying if grouping the objects I can write less lines to expand both the description field and the rectangle surrounding it.
Finally, not related, but curious. What are template controls? Do we only have datagrid row template controls or would my grouped object myPriceRow which I use again and again in a script be considered a templated control? I know datagrids contain template controls, do most of you use template controls for repetitive things or have I misinterpreted the word ‘templated’.
Thanks once again
Jalz
On a roll now, things seem to be finally falling into place. I do have another query, its more to do with efficiencies of grouped objects.
I have a two fields laid out next to each other aligned top with both the heights set to 21 (indicating a single line). The fields are called description and price. I have placed a solid rectangle around both fields. I have then grouped all three objects together and called it myPriceRow.
The question is the description field may contain x number of lines and I want the field to autoresize to display all the content of the field. So checking out the dictionary I came across the formattedheight command. I figured out that I can obtain the formattedheight of the content within the description field and then set the height of the description field so that its slightly greater than the formatted height of the content. This seemed to work fine, however two things I noted as issues.
1) When I set the height of the description field, the field increases in size from the centre outward, making description and price aligned in the centre rather than the top. Is there a way I can lock the top location before I set the height of description, so it grows downward? If not I will just have to get the top location of description before its grown and then readjust the alignment of the fields afterwards.
2) The second thing was, the solid rectangle which was around the fields needs to grow as well depending on the description field size. I can manually set the height of the rectangle object so it’s the formattedheight +10. However because I’ve grouped the items together, can I somehow use the groups properties to extend the description field and the solid rectangle in one line of code?
Both of the these things above I can do manually, I was mainly querying if grouping the objects I can write less lines to expand both the description field and the rectangle surrounding it.
Finally, not related, but curious. What are template controls? Do we only have datagrid row template controls or would my grouped object myPriceRow which I use again and again in a script be considered a templated control? I know datagrids contain template controls, do most of you use template controls for repetitive things or have I misinterpreted the word ‘templated’.
Thanks once again
Jalz
Re: Controlling grouped objects
Hi Jalz,
set the top of fld "description " to 14
set the top of fld "price" to 14
set the top of grp "myPriceRow" to 14
keram
Try with this, maybe it will work:jalz wrote:Is there a way I can lock the top location before I set the height of description, so it grows downward?
set the top of fld "description " to 14
set the top of fld "price" to 14
set the top of grp "myPriceRow" to 14
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Controlling grouped objects
The numbers I gave above you may adjust of course according to your layout.
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: Controlling grouped objects
You can tryIs there a way I can lock the top location before I set the height of description, so it grows downward?
Code: Select all
put the topLeft of fld "myField" into tTop
lock screen
set the height of fld "myField to 100
set the topLeft of fld "myField" to tTop
unlock screen
Re: Controlling grouped objects
Thanks Guys,
yes I've sorted this out by setting each object manually using the set the height command. I was just wondering whether there was a more efficient way of working with grouped objects when asking the question.
All the best
Jalz
yes I've sorted this out by setting each object manually using the set the height command. I was just wondering whether there was a more efficient way of working with grouped objects when asking the question.
All the best
Jalz
Re: Controlling grouped objects
I have never really used the geometry pane of any object, mainly because I do not know how it works. Does anyone know if it is possible to do what Jalz wants by using this tool? It seems that scaling an enclosing rectangle graphic when the field height changes is just what this gadget would be good for. (I do not see a natural way to hold the top of the field when the height changes. LC seems to base these changes on an immovable loc, not any edge.)
I think a tutorial on the geometry manager would be in order. I mean like a real lesson from Runrev.
Craig
I think a tutorial on the geometry manager would be in order. I mean like a real lesson from Runrev.
Craig
Re: Controlling grouped objects
Jalz.
It occurs to me that you could do this another way. Instead of simply setting the height of the field to the formattedHeight (which is always symmetrical about the loc), you could get that property and set the rect instead. Do you see what i mean? The rect could hold the top of the field invariant, and simply slide the bottom. Should be much shorter to implement.
Craig
It occurs to me that you could do this another way. Instead of simply setting the height of the field to the formattedHeight (which is always symmetrical about the loc), you could get that property and set the rect instead. Do you see what i mean? The rect could hold the top of the field invariant, and simply slide the bottom. Should be much shorter to implement.
Craig
Re: Controlling grouped objects
I have played with the geometry manager, and decided that it is either broken or just doesn't do what I think it's supposed to do. Either way, It is an area of LC that greatly needs revamping.
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Contact:
Re: Controlling grouped objects
Jalz - I also would be thinking of controlling the rect as Craig describes - and yes I agree Magice, the geometry manager should be given a wide berth...
"...this is not the code you are looking for..."