-
Notifications
You must be signed in to change notification settings - Fork 214
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
request to implement an element that is used on different pages #225
Comments
@Avpi18 This is already possible. In fact I recently saw an example where someone used a Listbox as |
@Pconti31 Thanks for your answer. |
@Avp18 If I were doing this kind of UI I would make Choose a Popup page. One more way of saving memory without using a base page is to use flash versions of UI elements. Beyond that I can't think of a good modification to GUIslice API for what you are asking. Unless Calvin can think of something you are left with doing this programmatically yourself IMHO, Good UI design does not involve moving buttons around. You should try for a consistent look and feel. |
Paul, thanks for taking the time to propose some potential workarounds. The good news is that I think there is a much simpler way of achieving this. Please note: The following is a quick response to give you an idea of one solution, but I'll update this later with a clearer example for you to try out, assuming you are using the Builder. I have tested this with a simple 3-page example based on ex05_ard_pages where I added an XListbox to the 2nd page (E_PG_EXTRA). I then added an element alias on the 3rd page (E_PG_EXTRA2). The simplest approach may be to do the following:
pElemRef = gslc_ElemAdd(&m_gui,E_PG_EXTRA2,gslc_GetElemFromRef(&m_gui,m_pElemListbox),GSLC_ELEMREF_DEFAULT);
#define MAX_ELEM_PG_EXTRA2 2+1 // Increase the element count to accommodate the alias The above will save you the cost of the extended element (eg. XListbox) and enable you to reuse all of its configuration, current selected state, etc. but still bear the memory cost of one element (~80B). If you want to save on the cost of the extra element as well, then I have an idea for a modification to this that may enable that as well. thx |
Hello @Pconti31 Thanks for your great feedback. I have also thought a little bit and then I got the idea with the pop up. i have already chosen the flash api= true. without this function my project would not be realizable. best thanks here also to Calvin Hass. Since ImpulseAdventure already suggested a slightly different method, I tried this one first and will continue with a pop up if the problem cannot be solved. Hello @ImpulseAdventure
has worked. I also used the ListSlider as Ref.
The problem I have to solve now is that the listslider is not compatible with the function :
, but only if I make a page break. More precisely explained: On Page_1 is my original ListSlider and on Page_2 is my copied/referenced element. If I now use the slider on Page_2, nothing happens. If I then leave Page_2 and go back to Page_2, it has adjusted the position. Do you have any idea how I can update the position of the ListSlider on Page_1 and Page_2 in real time? (With the original element, i.e. on Page_1, it updates when I use the ListSlider) |
Hi @Avpi18 — good to hear that progress has been made! I believe the only part missing was the linkage between the scrollbar position and the pair of listboxes (original and alias). Example sketchI put together a quick sketch in the Builder and it appears to be working. In my case I have:
High level overview of Changes
Detailed list of ChangesThe changes I needed to make to the sketch_GSLC.h:
m_pElemListbox2 = gslc_ElemAdd(&m_gui,E_PG3,gslc_GetElemFromRef(&m_gui,m_pElemListbox1),GSLC_ELEMREF_DEFAULT);
pElemRef = gslc_ElemAdd(&m_gui,E_PG3,gslc_GetElemFromRef(&m_gui,m_pListSlider1),GSLC_ELEMREF_DEFAULT); The changes I needed to make to the sketch.ino:
gslc_ElemXListboxSetScrollPos(pGui, m_pElemListbox1, nVal);
gslc_ElemXListboxSetScrollPos(pGui, m_pElemListbox2, nVal); Thanks |
Hello @ImpulseAdventure Thanks for your help. It's very kind and I appreciate your help. Actually I wanted to avoid that I have to create a new name, like But your detailed answer helped me anyway. I even think that you could include this example in your documentation, because there are surely more cases where you have to create an alias. The topic is closed for me now. Thanks to @Pconti31 and @ImpulseAdventure for your support. |
Hi @Avpi18 -- I had added the additional global just to make accessing the element alias elsewhere a little easier, but you're right -- it would probably be best to limit any extra edits. It is easy to avoid this step... I have included an updated change list for you below. Good suggestion on putting it in the wiki. I will create a section for tips and integrate this since I hadn't thought about "element aliases" until you asked the question :) Detailed list of ChangesThe changes I needed to make to the sketch_GSLC.h:
pElemRef = gslc_ElemAdd(&m_gui,E_PG3,gslc_GetElemFromRef(&m_gui,m_pElemListbox1),GSLC_ELEMREF_DEFAULT);
pElemRef = gslc_ElemAdd(&m_gui,E_PG3,gslc_GetElemFromRef(&m_gui,m_pListSlider1),GSLC_ELEMREF_DEFAULT); The changes I needed to make to the sketch.ino:
gslc_ElemXListboxSetScrollPos(pGui, m_pElemListbox1, nVal);
gslc_ElemXListboxSetScrollPos(pGui, gslc_PageFindElemById(pGui,E_PG3,E_ELEM_LISTBOX1), nVal); Hope that helps! |
Thank you for your answer. This helps a lot. I will implement this code and hope that it will work. the Project is progressing, thanks to you. |
hello @ImpulseAdventure This is what i tried: (I also adjusted the number of Elements on the Page. Normally, with a button it doesn't generate a pElemRef, so i tried but failed as you will see)
And then I added:
How can I create an alias to a button? I'm afraid I'm not getting anywhere with the last description from this topic. I hope for your support and thank you already now. |
the feature should make it possible to show the same element on different pages without further loading the RAM.
e.g. Page_1 with Listbox_1 and Page_2 with Listbox_1 in the same place.
The text was updated successfully, but these errors were encountered: