HH, and Richard:
Richard: Thanks for noticing the error in setting the textStyle.

Is this a bug? Shouldn’t the formattedHeight and formattedWidth show the text? 
I’m content to use my margins adjustment, but hope it doesn’t need to be 
revisited in the future. If so, it’s a small thing, but...

hh: 
Thanks for your suggestions. The problem that I have with your solution is that 
it works for very short texts, but for longer, the field is not resized to show 
the entire text string. The only way I can get this to work and show all of the 
text in the field is to set the margins to a value that works. The final 
solution I have is below:

function iml_makeField tName,tText

        if there is no cd fld tName then

                create field tName

        end if

        put tText into fld tName

        set the visible of fld tName to FALSE

        set the showBorder of fld tName to FALSE

        set the style of fld tName to "transparent"

        set the textAlign of fld tName to "center"

        set the textfont of fld tName to "Arial"

        set the textSize of fld tName to 12

        set the margins of fld tName to "4,2,4,6"

        set the dontWrap of fld tName to true

        set the textHeight of fld tName to 20

        set the fixedLineHeight of fld tName to TRUE

        set the textStyle of fld tName to bold

        put "0,0,"&(the formattedWidth of fld tName)&","&(the formattedHeight 
of fld tName) into tRect

        set the rect of fld tName to tRect

        return the rect of fld tName

end iml_makeField

> On Mar 18, 2016, at 12:05 AM, -hh <h...@livecode.org> wrote:
> 
> William P. wrote:
>> So, I guess we can't count on the formattedHeight and formattedWidth
>> to return dimensions of a rect that will show all of the text in a field?
> 
> Sorry? The (modified) function works here as it should, I wrote "works fine
> here".
> I think that simply the fixedTextHeight isn't set to true any more by
> default.
> 
> 
> 
> --
> View this message in context: 
> http://runtime-revolution.278305.n4.nabble.com/Problems-creating-a-field-in-LC8-DP16-tp4702326p4702332.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

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

Reply via email to