Puzzled by button focus behaviour


I am running Windows VS V8.x,x Simulator on Win10. Been experimenting with buttons, I cant understand what controls when the blue focus outline that appears around a button ? It seems unpredictable to me.

Taking the button example lv_example_btn_1.c file. The top button has the focus and draws the outline, clicking on that button retains the focus outline as expected. If I click on the toggle button tjhat doesnt show the focus outline, and then if I click back on the top button that no longer shows the focus outline. The focus outline wont come back until i re-run the example.

Two questions
Q1) Is this expected behavour, what is the logic for when a focus outline is drawn ?

Q2) I tried to turn off the focus outline, but couldnt get it to work. Neither of these lines turn it off

lv_obj_clear_state(btn1, LV_STATE_FOCUSED);
lv_obj_clear_flag(btn1, LV_OBJ_FLAG_CLICK_FOCUSABLE);

Searching around I found this suggestion

v_obj_add_protect(obj_btn_A, LV_PROTECT_CLICK_FOCUS);

However that function seems to be gone in V8 and I couldnt find an equivalent function.

Any help on how to turn the outline off please ?

1 Like

any solution available for v8 ?
The focus marking makes not much sense when using a touchscreen (in my opinion)

do you mean the blue outline when focusing the button? you can try change outline in LV_STATE_FOCUS_KEY