Removing back button from fileselector

Hi again,

please see the full version of my repetier on github:

https://github.com/Anteino/Repetier-Firmware/tree/500XL-Minimal/src/ArduinoDUE/Repetier

I want to remove the back button from the fileselector. In uimenu.h, when I change:

#define UI_MENU_SD_FILESELECTOR {&ui_menu_back}

to:

#define UI_MENU_SD_FILESELECTOR {}

It seems to work at first. Only when I start scrolling through the folders on my SD it always picks the wrong folder when you click one. It selects the one above where the CHAR_SELECTOR is at. And when you pick the top folder it goes out of the whole file selector by a UI_ACTION_BACK. This can be compensated by shifting the menupos variable by one, even though it's strange that I'd have to do this. However, when I try to scroll past the last folder on my sd card it takes me two clicks. This results in disalignment when selecting a file on the root of the sd card, the file beneath the one you select gets actually selected. This is what my sd card looks like:



This has been bugging me for quite some time now and I can't seem to figure it out on my own. Don't mind all the debug messages in I added in the code. It didn't noticeably change the functionality of the printer. It was just to check which part of code was executed in what order.

So, what I actually want to do is this. In the fileselector there may be no "return" or "go to parent folder" buttons. By clicking the physical back button you go one folder up, if you're in the root trying to go one folder up you leave the menu. I've tried removing the first entry from the "stack" of the display entries but it doesn't seem to work that way for the fileselector. I'm really in the dark here. Please help me :/

Comments

  • You can not do it that way.

    #define UI_HAS_BACK_KEY 1

    says to add back entry in all the menus while 0 would remove it. The variable is normally set in your display definition and set to 0 if you have a dedicated back button, otherwise you want the back button.

  • edited November 2017
    #define UI_HAS_BACK_KEY 1

    says to add back entry in all the menus while 0 would remove it.

    Really? because the documentation in the firmware itself says this: Setting this value to 1 removes the back entry. So it is set to 1 in my case, and it does remove all the back entries except for the one in the fileselector. That is the problem I am having here. If I remove the back entry from the fileselector manually with the method described in my first post, the top file on my sd card becomes the back entry seemingly.
  • You are right - UI_HAS_BACK_KEY says if you have a back key or not and not menu entry. If you have the key the menus are removed.

    The problem with the file menu is a bit difficult since we can not add the content, so files gets added dynamically and functions relying on this assume that the first file is at index 1. Removing the back here makes the logic invalid. So to remove it there you need to adjust all file related function in ui.cpp and remove the -1 from the counting where we go through the lists. Then it would match and select the right file.
Sign In or Register to comment.