frang75 / nappgui_src

SDK for building cross-platform desktop apps in ANSI-C
https://www.nappgui.com
MIT License
485 stars 48 forks source link

Cannot Set Default Font For Empty TextView #147

Open apaly opened 2 weeks ago

apaly commented 2 weeks ago

Hi @frang75 , Thanks for this great library. I am trying out the TextView control. It seems it isn’t possible to set default font for an empty TextView. I set the font using textview_family and textview_fsize and typed some texts using the keyboard but these settings didn’t have any effect. Likewise, I found out that textview_fsize, textview_afspace and textview_lspacing didn’t work for an empty TextView either.

I would really appreciate how I can sent these settings for an empty TextView.

Thanks, Apaly

frang75 commented 2 weeks ago

Hi @apaly! Thanks for download and use NAppGUI. The text properties in TextView will be applied in next textview_writef(). I will fix the control so that they are taken into account in editing.

apaly commented 2 weeks ago

Hi @frang75, Thanks a lot. Your commitment to the library is impressive.

frang75 commented 2 weeks ago

Implemented on this commit: https://github.com/frang75/nappgui_src/commit/f6c2ee06145f6f8c830c1e3870a1ecb6ff517b36

In order not to alter the current operation of the control, the textview_apply_all() function has been added, which sets the text parameters for the entire control. If the control is empty, they will be taken as default attributes.

Doc: https://nappgui.com/en/gui/textview.html#h4 Demo: https://nappgui.com/en/howto/guihello.html#h6

frang75 commented 2 weeks ago

Related with this issue: https://github.com/frang75/nappgui_src/issues/148

apaly commented 2 weeks ago

@frang75, all I can say is wow! to your very quick response to this issue and update of the documentation!

The solution is also well thought out.

Thanks a lot.