[JW Lua] Dynamic dialog sizing

Robert Patterson robert at robertgpatterson.com
Fri Feb 24 19:00:01 CET 2023


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230224/eed946fc/attachment.html>


More information about the JWLua mailing list