hishizuka / pizero_bikecomputer

An open source bike computer based on Raspberry Pi Zero (W, WH, 2W) with GPS and ANT+. Including offline map and navigation.

Home Page:https://qiita.com/hishi/items/46619b271daaa9ad41b3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Back button on non touch device

Ptosiek opened this issue · comments

I'm struggling a bit setting the focus on proper widget (Trying to replace the code setting focus_widget/delete_focus).
I did have fixed it but I actually wonder. If I understand properly the logic:

  • If we have touch, no focus is set by default, which ends up being the back button
  • If we don't have touch, the focus tried to be set on first element or back button.

Now we can have the case where touch is broken/user wants to use the physical buttons anyway. (I guess that it's why the delete_focus is made only when not on the Pi). So we need something to focus by default: which ends up being the (graphical) back button in that case.
But, we can always leave the screen by using the physical one so it's a bit redundant. Actually for a 'pure' non touch device the graphical back button is hardly gonna be used.

I think by:

  1. having the back button never focusable.
  2. having always focus set a similar way if touch/no touch device.

This would very much simplify the code around setting the next focus widget . The only con is see is that even on touch device we will have something focused in (as in: a menu item compared to the back button previously) when opening menu

(for 1. we could remove the graphical back button for non-touch devices, but probably better not doing it)

P.S: Prob an error in the documentation:
image
A and E in that case should be Left (<) and Right (>)

Seems to be a rabbit hole and NO_FOCUS policy not always working.
Will keep the actual logic for now

Hi @Ptosiek , thanks for your opinion.

My thoughts are right in line with your predictions,

  1. If mouse or touch can be used, don't show focus (no need to show it).
  2. If only buttons can be used, set the focus

The graphical back button was created in case only 2 or 3 buttons can be used.
For example,
https://www.dfrobot.com/product-1866.html

Thanks for pointing out the documentation. I'm not sure I have all the right wording. I will fix it soon.