Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text poistion in lv_ta #38

Closed
BenQoo opened this issue Oct 6, 2017 · 6 comments
Closed

Text poistion in lv_ta #38

BenQoo opened this issue Oct 6, 2017 · 6 comments

Comments

@BenQoo
Copy link
Contributor

BenQoo commented Oct 6, 2017

I have a question. If I would like to adjust the position of text in lv_ta, which vpad and hpad should I take?

  • Style of lv_ta
  • Style of scrollbar style_sb from lv_page_get_style_sb(ta)

I made some try. I use ptask to change vpad periodically.
I set vpad on style of lv_ta, it worked on the first time call lv_obj_set_style(ta, &ta_style), but it didn't work on the second time or set style to the other new lv_style_t.
About style_sb, It's no effect by changing its vpad.

Thanks!

@kisvegabor
Copy link
Member

kisvegabor commented Oct 6, 2017

It really doesn't work properly. I will fix it on Monday. Until that please try this: lv_obj_set_style(lv_page_get_scrl(ta), &style) it will set the style of the transparent scrollable part of text area. Use LV_STYLE_TRANSP_TIGHT as starting point.

vpad and hpad now do not affect the scrollbar position but it is a good idea to do that!

@kisvegabor
Copy link
Member

kisvegabor commented Oct 9, 2017

Now the label's position should be affected by hpad and vpad.
Can you test it?

How do you imagine the scrollbar and hpad/vpad relationship?

@BenQoo
Copy link
Contributor Author

BenQoo commented Oct 16, 2017

Now the label's position should be affected by hpad and vpad.
Can you test it?

No problem.
After testing, It works now, thank you!

How do you imagine the scrollbar and hpad/vpad relationship?

Sorry, I'm not familiar with them. I guess it can change hpad/vpad to adjust the position of scrollbar.

@kisvegabor
Copy link
Member

I'm happy that it's working! :)

I will figure out something for scrollbar.

@kisvegabor
Copy link
Member

In beta scrollbar positions are affected by style.body.padding.hor and style.body.padding.hor.
(Please update you misc_conf.h and lv_conf.h from misc_conf_templ.h and lv_conf_templ.h)

Like this:

    static lv_style_t sb_style;
    lv_style_copy(&sb_style, &lv_style_plain_color);
    sb_style.body.padding.hor = -15;
    sb_style.body.padding.ver = 15;

    lv_obj_t *page = lv_page_create(lv_scr_act(), NULL);
    lv_page_set_style(page, LV_PAGE_STYLE_SB, &sb_style);
    lv_page_set_sb_mode(page, LV_SB_MODE_ON);
    lv_page_set_scrl_fit(page, true, true);
    lv_obj_set_size_scale(page, 100, 200);
    lv_obj_set_pos_scale(page, 10, 10);

    lv_obj_t *label = lv_label_create(page, NULL);
    lv_label_set_text(label, "long long lines\n\n"
                             "to shows the\n\n"
                             "scrollbars'\n\n"
                             "position.\n\n"
                             "Some dummy text\n\n"
                             "Some dummy text\n\n"
                             "Some dummy text\n\n");

screenshot from 2017-11-20 14-14-17

@kisvegabor
Copy link
Member

Added in v5.0.0

perimeno pushed a commit to perimeno/lvgl that referenced this issue Apr 10, 2020
Remove taskYIELD() Calls and fix Kconfig slightly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants