[JW Lua] Dynamic dialog sizing

Robert Patterson robert at robertgpatterson.com
Fri Feb 24 21:44:40 CET 2023


Have a look at FCTextMetrics. There are a couple of options, but you might
try GetAdvanceWidthEVPUs first.

On Fri, Feb 24, 2023 at 12:42 PM Aaron Sherber <aaron at sherber.com> wrote:

> How can you get the text width from FCFontInfo? I don't see any functions
> for that.
>
> Thanks,
> Aaron.
>
>
>
>
>
>
> On Fri, Feb 24, 2023 at 1:01 PM Robert Patterson <
> robert at robertgpatterson.com> wrote:
>
>> You could call CreateFontInfo on the control and then use that to get the
>> text width. You probably need to do this in the InitWindow callback.
>>
>> On Fri, Feb 24, 2023 at 11:45 AM Aaron Sherber <aaron at sherber.com> wrote:
>>
>>> Hi all,
>>>
>>> I see that a couple of places in the library multiply character count by
>>> 6 in order to get control length. Is that a reasonable approximation for
>>> the default text fonts?
>>>
>>> Thanks,
>>> Aaron.
>>>
>>>
>>>
>>>
>>> On Fri, Feb 24, 2023 at 8:51 AM Aaron Sherber <aaron at sherber.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm working with FCCustom(Lua)Window and having some difficulties with
>>>> sizing.
>>>>
>>>> I want to display a static label on a dialog, but I don't know at
>>>> design time how long the text in the label is -- let's say it's a
>>>> path+filename. I don't see a way to make the FCCtrlStatic dynamically fit
>>>> the length of the text, or to make the overall width of the dialog fit the
>>>> length of the control.
>>>>
>>>> Is there a good way to accomplish this? Or is my best bet to
>>>> approximate the needed control length in points based on the character
>>>> count and then set sizes based on that, hoping that everything works?
>>>>
>>>> Thanks,
>>>> Aaron.
>>>>
>>> _______________________________________________
>>> JWLua mailing list
>>> JWLua at jwmusic.nu
>>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>>
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230224/b1d54d30/attachment.html>


More information about the JWLua mailing list