<?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 Editing pages with custom codes in Gui Guider in GUI Guider</title>
    <link>https://community.nxp.com/t5/GUI-Guider/Editing-pages-with-custom-codes-in-Gui-Guider/m-p/1698657#M417</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I use Gui Guider 1.5.1 and v8.3.2 Lvgl.&lt;BR /&gt;&lt;BR /&gt;I have created 2 pages and I can switch from one to another. When I switch the page and then turn back to the same page, this button we created becomes unvisible. How can I make it visible forever on that page ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In fact I want to know how to manipulate generated files with custom codes. For example there is a screen and there is a button on that screen built with Gui Guider, how can I change this button's spesifications with custom area files ?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frozen_0-1691068552075.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/234960iA35B0750D357CF5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frozen_0-1691068552075.png" alt="frozen_0-1691068552075.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frozen_1-1691068573702.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/234961iEDA2F2FE02E9F45A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frozen_1-1691068573702.png" alt="frozen_1-1691068573702.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/**
*custom.c file
**/
#include &amp;lt;stdio.h&amp;gt;
#include "lvgl.h"
#include "custom.h"
//#include "src/examples/lv_examples.h"

lv_obj_t *btn2;
lv_obj_t *btn;

static void btn_event_cb2(lv_event_t * e)
{
    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t * btn2 = lv_event_get_target(e);
    if(code == LV_EVENT_CLICKED) {
        static uint8_t cnt = 0;
        cnt++;

        /*Get the first child of the button which is the label and change its text*/
        lv_obj_t * label = lv_obj_get_child(btn2, 0);
        lv_label_set_text_fmt(label, "Button: %d", cnt);
    }
}

static void btn_event_cb(lv_event_t *event)
{
	lv_event_code_t code = lv_event_get_code(event);
	
    if(code == LV_EVENT_CLICKED)
	{
        static uint8_t cnt = 0;
        cnt++;

        /*Get the first child of the button which is the label and change its text*/
        lv_obj_t * label = lv_obj_get_child(btn, NULL);
        lv_label_set_text_fmt(label, "Button: %d", cnt);
    }
}

void lv_example_get_started_2(void)
{
    btn2 = lv_btn_create(lv_scr_act());     /*Add a button the current screen*/
    lv_obj_set_pos(btn2, 10, 10);                            /*Set its position*/
    lv_obj_set_size(btn2, 120, 50);                          /*Set its size*/
    //lv_obj_add_event(btn2, btn_event_cb2, LV_EVENT_ALL, NULL);           /*Assign a callback to the button*/

    lv_obj_t * label = lv_label_create(btn2);          /*Add a label to the button*/
    lv_label_set_text(label, "Button");                     /*Set the labels text*/
    lv_obj_center(label);
}

void lv_ex_get_started_1(void)
{
	static int btn2_no = 2;
	btn = lv_btn_create(lv_scr_act());
    
    lv_obj_set_pos(btn, 100, 100);                            /*Set its position*/
    lv_obj_set_size(btn, 120, 50);                          /*Set its size*/

	lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL,&amp;amp;btn2_no);
    lv_obj_t * label = lv_label_create(btn);          /*Add a label to the button*/
    lv_label_set_text(label, "Button1");                     /*Set the labels text*/
}

void custom_init(lv_ui *ui)
{
    /* Add your codes here */
	lv_ex_get_started_1();
	lv_example_get_started_2();

lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xf92f3f), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2023 13:17:52 GMT</pubDate>
    <dc:creator>frozen</dc:creator>
    <dc:date>2023-08-03T13:17:52Z</dc:date>
    <item>
      <title>Editing pages with custom codes in Gui Guider</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Editing-pages-with-custom-codes-in-Gui-Guider/m-p/1698657#M417</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I use Gui Guider 1.5.1 and v8.3.2 Lvgl.&lt;BR /&gt;&lt;BR /&gt;I have created 2 pages and I can switch from one to another. When I switch the page and then turn back to the same page, this button we created becomes unvisible. How can I make it visible forever on that page ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In fact I want to know how to manipulate generated files with custom codes. For example there is a screen and there is a button on that screen built with Gui Guider, how can I change this button's spesifications with custom area files ?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frozen_0-1691068552075.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/234960iA35B0750D357CF5A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frozen_0-1691068552075.png" alt="frozen_0-1691068552075.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="frozen_1-1691068573702.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/234961iEDA2F2FE02E9F45A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="frozen_1-1691068573702.png" alt="frozen_1-1691068573702.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/**
*custom.c file
**/
#include &amp;lt;stdio.h&amp;gt;
#include "lvgl.h"
#include "custom.h"
//#include "src/examples/lv_examples.h"

lv_obj_t *btn2;
lv_obj_t *btn;

static void btn_event_cb2(lv_event_t * e)
{
    lv_event_code_t code = lv_event_get_code(e);
    lv_obj_t * btn2 = lv_event_get_target(e);
    if(code == LV_EVENT_CLICKED) {
        static uint8_t cnt = 0;
        cnt++;

        /*Get the first child of the button which is the label and change its text*/
        lv_obj_t * label = lv_obj_get_child(btn2, 0);
        lv_label_set_text_fmt(label, "Button: %d", cnt);
    }
}

static void btn_event_cb(lv_event_t *event)
{
	lv_event_code_t code = lv_event_get_code(event);
	
    if(code == LV_EVENT_CLICKED)
	{
        static uint8_t cnt = 0;
        cnt++;

        /*Get the first child of the button which is the label and change its text*/
        lv_obj_t * label = lv_obj_get_child(btn, NULL);
        lv_label_set_text_fmt(label, "Button: %d", cnt);
    }
}

void lv_example_get_started_2(void)
{
    btn2 = lv_btn_create(lv_scr_act());     /*Add a button the current screen*/
    lv_obj_set_pos(btn2, 10, 10);                            /*Set its position*/
    lv_obj_set_size(btn2, 120, 50);                          /*Set its size*/
    //lv_obj_add_event(btn2, btn_event_cb2, LV_EVENT_ALL, NULL);           /*Assign a callback to the button*/

    lv_obj_t * label = lv_label_create(btn2);          /*Add a label to the button*/
    lv_label_set_text(label, "Button");                     /*Set the labels text*/
    lv_obj_center(label);
}

void lv_ex_get_started_1(void)
{
	static int btn2_no = 2;
	btn = lv_btn_create(lv_scr_act());
    
    lv_obj_set_pos(btn, 100, 100);                            /*Set its position*/
    lv_obj_set_size(btn, 120, 50);                          /*Set its size*/

	lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL,&amp;amp;btn2_no);
    lv_obj_t * label = lv_label_create(btn);          /*Add a label to the button*/
    lv_label_set_text(label, "Button1");                     /*Set the labels text*/
}

void custom_init(lv_ui *ui)
{
    /* Add your codes here */
	lv_ex_get_started_1();
	lv_example_get_started_2();

lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x003a57), LV_PART_MAIN);
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Hello world");
lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xf92f3f), LV_PART_MAIN);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 13:17:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Editing-pages-with-custom-codes-in-Gui-Guider/m-p/1698657#M417</guid>
      <dc:creator>frozen</dc:creator>
      <dc:date>2023-08-03T13:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Editing pages with custom codes in Gui Guider</title>
      <link>https://community.nxp.com/t5/GUI-Guider/Editing-pages-with-custom-codes-in-Gui-Guider/m-p/1699150#M420</link>
      <description>&lt;P&gt;Hi, frozen&lt;BR /&gt;I made some modifications to the code in "custom.c/custom.h", and made the button always on the display by reloading the button object in the new interface. The specific method is as follows:&lt;/P&gt;
&lt;P&gt;1. Modify the code in "custom.c/custom.h".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_0-1691129391435.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235071i94883B44026F6AA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_0-1691129391435.png" alt="Xu_Zhang_0-1691129391435.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_1-1691129402255.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235072i8B7E2742CF58ED71/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_1-1691129402255.png" alt="Xu_Zhang_1-1691129402255.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;2. Add a button control named "btn_1". Add the second page named "screen_1".&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_2-1691129433715.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235073iD4ED1D66F75D4529/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_2-1691129433715.png" alt="Xu_Zhang_2-1691129433715.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;3. Add two events to btn_1, namely page switching event and custom event.&lt;BR /&gt;The time in the page switch event is set to 0.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_3-1691129487889.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235074i9C71CC7472BDD258/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_3-1691129487889.png" alt="Xu_Zhang_3-1691129487889.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Add header files #include "custom.h" and" lv_ex_get_started_1()" to the custom event "Edit Code"&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_4-1691129535622.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235076iFF71665D07A31DD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_4-1691129535622.png" alt="Xu_Zhang_4-1691129535622.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4. Generate the code again, you can see the following program in "events_init.c", and then view the effect in the emulator.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Xu_Zhang_5-1691129575488.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/235077i1D581F30B9C8877F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Xu_Zhang_5-1691129575488.png" alt="Xu_Zhang_5-1691129575488.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Xu Zhang&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Aug 2023 06:34:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/GUI-Guider/Editing-pages-with-custom-codes-in-Gui-Guider/m-p/1699150#M420</guid>
      <dc:creator>Xu_Zhang</dc:creator>
      <dc:date>2023-08-04T06:34:23Z</dc:date>
    </item>
  </channel>
</rss>

