<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Button widget text wrap in GUI Guider</title>
    <link>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502428#M117</link>
    <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193669"&gt;@mitchkapa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;it's definitely possible but requires manual changes to the code after you've generated it.&lt;/P&gt;
&lt;P&gt;This is the way a label is added to a button "setup_scr_screen.c":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;	ui-&amp;gt;screen_btn_1_label = lv_label_create(ui-&amp;gt;screen_btn_1);
	lv_label_set_text(ui-&amp;gt;screen_btn_1_label, "very very very very very very very long text wrapped with LV_LABEL_LONG_SCROLL");
	lv_obj_set_style_pad_all(ui-&amp;gt;screen_btn_1, 0, LV_STATE_DEFAULT);
	lv_obj_align(ui-&amp;gt;screen_btn_1_label, LV_ALIGN_CENTER, 0, 0);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to enable wrapping you need to do two things.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Manually edit the width of the label inside the button: &lt;STRONG&gt;lv_obj_set_width(ui-&amp;gt;screen_btn_1_label, lv_pct(90));&lt;/STRONG&gt; - the lv_pct(90) value sets the width to 90% of the width of the parent (meaning the button in this case). You can also use an absolute value, like 200. By default it seems that LVGL sets the width to fit the whole text in the label and doesn't take the button width into consideration, which means that the label is created as wider than the button even though it's inside the button and simply enabling wrapping won't have any effect.&lt;/LI&gt;
&lt;LI&gt;Choose the long text behavior:&lt;STRONG&gt; lv_label_set_long_mode(ui-&amp;gt;screen_btn_1_label, LV_LABEL_LONG_WRAP);&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;	ui-&amp;gt;screen_btn_1_label = lv_label_create(ui-&amp;gt;screen_btn_1);
	lv_label_set_text(ui-&amp;gt;screen_btn_1_label, "very very very very very very very long text wrapped with LV_LABEL_LONG_SCROLL");
	lv_obj_set_width(ui-&amp;gt;screen_btn_1_label, lv_pct(90));
	lv_label_set_long_mode(ui-&amp;gt;screen_btn_1_label, LV_LABEL_LONG_WRAP);
	lv_obj_set_style_pad_all(ui-&amp;gt;screen_btn_1, 0, LV_STATE_DEFAULT);
	lv_obj_align(ui-&amp;gt;screen_btn_1_label, LV_ALIGN_CENTER, 0, 0);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will suggest to add this functionality inside Gui Guider so that people don't have to manually edit it every time. Thanks for the question!&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20220808_104454.jpg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/189430iE07BA6F45F27AE1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20220808_104454.jpg" alt="IMG_20220808_104454.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 11:17:58 GMT</pubDate>
    <dc:creator>david_piskula</dc:creator>
    <dc:date>2022-08-08T11:17:58Z</dc:date>
    <item>
      <title>Button widget text wrap</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502019#M116</link>
      <description>&lt;P&gt;Is it possible to have the text within a button widget wrap to appear on multiple lines?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 22:24:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502019#M116</guid>
      <dc:creator>mitchkapa</dc:creator>
      <dc:date>2022-08-05T22:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Button widget text wrap</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502428#M117</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193669"&gt;@mitchkapa&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;it's definitely possible but requires manual changes to the code after you've generated it.&lt;/P&gt;
&lt;P&gt;This is the way a label is added to a button "setup_scr_screen.c":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;	ui-&amp;gt;screen_btn_1_label = lv_label_create(ui-&amp;gt;screen_btn_1);
	lv_label_set_text(ui-&amp;gt;screen_btn_1_label, "very very very very very very very long text wrapped with LV_LABEL_LONG_SCROLL");
	lv_obj_set_style_pad_all(ui-&amp;gt;screen_btn_1, 0, LV_STATE_DEFAULT);
	lv_obj_align(ui-&amp;gt;screen_btn_1_label, LV_ALIGN_CENTER, 0, 0);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to enable wrapping you need to do two things.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Manually edit the width of the label inside the button: &lt;STRONG&gt;lv_obj_set_width(ui-&amp;gt;screen_btn_1_label, lv_pct(90));&lt;/STRONG&gt; - the lv_pct(90) value sets the width to 90% of the width of the parent (meaning the button in this case). You can also use an absolute value, like 200. By default it seems that LVGL sets the width to fit the whole text in the label and doesn't take the button width into consideration, which means that the label is created as wider than the button even though it's inside the button and simply enabling wrapping won't have any effect.&lt;/LI&gt;
&lt;LI&gt;Choose the long text behavior:&lt;STRONG&gt; lv_label_set_long_mode(ui-&amp;gt;screen_btn_1_label, LV_LABEL_LONG_WRAP);&lt;/STRONG&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;	ui-&amp;gt;screen_btn_1_label = lv_label_create(ui-&amp;gt;screen_btn_1);
	lv_label_set_text(ui-&amp;gt;screen_btn_1_label, "very very very very very very very long text wrapped with LV_LABEL_LONG_SCROLL");
	lv_obj_set_width(ui-&amp;gt;screen_btn_1_label, lv_pct(90));
	lv_label_set_long_mode(ui-&amp;gt;screen_btn_1_label, LV_LABEL_LONG_WRAP);
	lv_obj_set_style_pad_all(ui-&amp;gt;screen_btn_1, 0, LV_STATE_DEFAULT);
	lv_obj_align(ui-&amp;gt;screen_btn_1_label, LV_ALIGN_CENTER, 0, 0);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will suggest to add this functionality inside Gui Guider so that people don't have to manually edit it every time. Thanks for the question!&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG_20220808_104454.jpg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/189430iE07BA6F45F27AE1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IMG_20220808_104454.jpg" alt="IMG_20220808_104454.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 11:17:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502428#M117</guid>
      <dc:creator>david_piskula</dc:creator>
      <dc:date>2022-08-08T11:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Button widget text wrap</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502536#M118</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193669"&gt;@mitchkapa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have escalated it as a GUI Guider feature request.&lt;/P&gt;
&lt;P&gt;Thanks for bringing the problem to our attention.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Jun Zhang&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 10:48:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502536#M118</guid>
      <dc:creator>ZhangJennie</dc:creator>
      <dc:date>2022-08-08T10:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Button widget text wrap</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502703#M119</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 16:19:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Button-widget-text-wrap/m-p/1502703#M119</guid>
      <dc:creator>mitchkapa</dc:creator>
      <dc:date>2022-08-08T16:19:35Z</dc:date>
    </item>
  </channel>
</rss>

