{"action":"created","issue":{"url":"https://api.github.com/repos/littlevgl/lvgl/issues/93","repository_url":"https://api.github.com/repos/littlevgl/lvgl","labels_url":"https://api.github.com/repos/littlevgl/lvgl/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/littlevgl/lvgl/issues/93/comments","events_url":"https://api.github.com/repos/littlevgl/lvgl/issues/93/events","html_url":"https://github.com/littlevgl/lvgl/issues/93","id":292791409,"number":93,"title":"button to change screen","user":{"login":"Zaltora","id":5892130,"avatar_url":"https://avatars1.githubusercontent.com/u/5892130?v=4","gravatar_id":"","url":"https://api.github.com/users/Zaltora","html_url":"https://github.com/Zaltora","followers_url":"https://api.github.com/users/Zaltora/followers","following_url":"https://api.github.com/users/Zaltora/following{/other_user}","gists_url":"https://api.github.com/users/Zaltora/gists{/gist_id}","starred_url":"https://api.github.com/users/Zaltora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zaltora/subscriptions","organizations_url":"https://api.github.com/users/Zaltora/orgs","repos_url":"https://api.github.com/users/Zaltora/repos","events_url":"https://api.github.com/users/Zaltora/events{/privacy}","received_events_url":"https://api.github.com/users/Zaltora/received_events","type":"User","site_admin":false},"labels":[{"id":389374650,"url":"https://api.github.com/repos/littlevgl/lvgl/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2018-01-30T13:56:39Z","updated_at":"2018-02-06T09:05:23Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I am new with lvgl API and i try to understand the KEYPAD system. I need help.\r\nMy hardware: OLED monochrome + 4 buttons.\r\nButton config wanted:  ESC/LEFT/RIGHT/OK\r\n\r\nmy first thought with lvgl would be to use a button to change the contents of a label (if it is possible ?)\r\nI see some API to retrieve cursor position but not for retrieve button pressed/released ? ( it is exist one ?)\r\nI want to know if it is possible when a do an action, to change screen content ?\r\nI try do not use complex object because the screen is small (128x64 ).\r\n\r\nThis is the example i test to try the lvgl behaviour:\r\n```c\r\nbool button_read(lv_indev_data_t * data)\r\n{\r\n    //update_adc();\r\n    /*Store the collected data*/\r\n    data->key = LV_GROUP_KEY_ENTER ; \r\n    data->state = left_button_down ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;\r\n    return false;\r\n}\r\n\r\nint screen (void)\r\n{\r\n    //custom input\r\n    lv_indev_drv_t indev_drv2;\r\n    lv_indev_drv_init(&indev_drv2);      \r\n    indev_drv2.type = LV_INDEV_TYPE_KEYPAD;\r\n    indev_drv2.read = button_read;      \r\n    lv_indev_drv_register(&indev_drv2);\r\n\r\n    lv_obj_t * scr = lv_obj_create(NULL, NULL);\r\n    lv_scr_load(scr);\r\n//SCREEN 1\r\n    //lv_obj_t * win = lv_win_create(lv_scr_act(), NULL);\r\n    /*Create a Label on the currently active screen*/\r\n    lv_obj_t * label1 =  lv_label_create(lv_scr_act(), NULL);\r\n    lv_obj_t * label2 =  lv_label_create(lv_scr_act(), NULL);\r\n\r\n    char buf[32];\r\n    sprintf(buf, \"%s%s\", SYMBOL_WIFI,SYMBOL_BATTERY_FULL);\r\n    lv_label_set_text(label1,buf);\r\n    lv_obj_align(label1, scr, LV_ALIGN_IN_TOP_RIGHT, 0, 0);\r\n    lv_label_set_long_mode(label2, LV_LABEL_LONG_DOT);\r\n    lv_obj_set_size(label2, 128, 20);\r\n    lv_label_set_text(label2, \"mytext_3h_nope.txt\");\r\n    lv_obj_align(label2, scr, LV_ALIGN_IN_BOTTOM_MID, 0, 0);\r\n\r\n////SCREEN 2\r\n\r\n    lv_obj_t * scr2 = lv_obj_create(NULL, NULL);\r\n    //lv_obj_t * win2 = lv_win_create(scr2, NULL);\r\n    lv_obj_t * bar1 = lv_bar_create(scr2, NULL);\r\n    lv_obj_set_size(bar1, 100, 20);\r\n    lv_obj_align(bar1, scr2, LV_ALIGN_IN_BOTTOM_MID, 0, 0);\r\n    lv_bar_set_value(bar1, 70);\r\n    /*Create a label right to the bar*/\r\n    lv_obj_t * bar1_label = lv_label_create(scr2, NULL);\r\n    lv_label_set_text(bar1_label, \"Progress\");\r\n    lv_obj_align(bar1_label, scr2, LV_ALIGN_IN_TOP_LEFT, 0, 0);\r\n\r\n//group settings\r\n    lv_group_t *group = lv_group_create();\r\n    lv_group_add_obj(group, scr);\r\n    lv_group_add_obj(group, scr2);\r\n}\r\n```\r\n\r\nWhat missing to swap between 2 screen with the button.\r\nIn my app, when i click on OK, it will load a file. I need to change screen when i put OK.\r\nIf i use next/prev, the label need change and draw the next/prev file name. (need list to do it ?)\r\n\r\nlvgl permit to retrieve button action to permit \"user app\" to do some treatments ?\r\nOr can i register a callback function on button event ?\r\nWhat i am wrong with my code template ? \r\n\r\nThank you "},"comment":{"url":"https://api.github.com/repos/littlevgl/lvgl/issues/comments/363356276","html_url":"https://github.com/littlevgl/lvgl/issues/93#issuecomment-363356276","issue_url":"https://api.github.com/repos/littlevgl/lvgl/issues/93","id":363356276,"user":{"login":"qwert1213131","id":3905169,"avatar_url":"https://avatars0.githubusercontent.com/u/3905169?v=4","gravatar_id":"","url":"https://api.github.com/users/qwert1213131","html_url":"https://github.com/qwert1213131","followers_url":"https://api.github.com/users/qwert1213131/followers","following_url":"https://api.github.com/users/qwert1213131/following{/other_user}","gists_url":"https://api.github.com/users/qwert1213131/gists{/gist_id}","starred_url":"https://api.github.com/users/qwert1213131/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qwert1213131/subscriptions","organizations_url":"https://api.github.com/users/qwert1213131/orgs","repos_url":"https://api.github.com/users/qwert1213131/repos","events_url":"https://api.github.com/users/qwert1213131/events{/privacy}","received_events_url":"https://api.github.com/users/qwert1213131/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T09:05:23Z","updated_at":"2018-02-06T09:05:23Z","author_association":"NONE","body":"I have an idea.\r\nIf the screen is partitioned into different functional areas (the equivalent of hidden buttons), when the area touches the action or the physical key is pressed, it triggers a specific function.\r\nI don't know whether it is feasible.\r\nThis is more suitable for small screen devices.\r\n![20180206170458](https://user-images.githubusercontent.com/3905169/35850467-e8590f78-0b5f-11e8-8c71-59ed6b6488d3.png)\r\n"}}
{"actor":{"display_login":"qwert1213131"}}