UiApp cache vertical panel - google-apps-script

Developing small app to record a set of 6 readings for monitoring purposes in 31 rooms. App will have two main views, one view to show list of buttons for each room where readings will be taken, a second view where the values will be entered for a particular room and then posted to a spreadsheet.
The process in mind here is click on button for a particular room, enter the data, return to button view to choose another room to enter the data for that room and then back to button view screen.
Since the button view will seldom change do I have any options for caching this view so that I do not have to run a function to rebuild it each time. I have this function
function createTGSRoomListButtons(sh, aData){}
That takes the list of rooms and builds a panel of buttons for selecting the different rooms.
The question that I have can the above function be run once to cobble together the UI, cached and the later simply be 'recalled'?
TO that some end the view where the data will be entered can this be partially cached so that with each rendering a reference to a specific room can be made.
New to Google Apps Script so not really sure how to properly determine my answer.

You can have multiple panels in an UI and play with visibility to show one or another... no need to cache any content since they remain unchanged in the process.
If I understood your use case well, the panel with specific room info would be modified according to spreadsheet data so in this case you won't need to cache values since they would be "reconstructed" each time. The trick to show/hide panel has been shown in this post with clientHandlersand multiple panels in a unique vertical panel to ensure that the visible panel is always at the right place.

A very simple way would be build the UI for the first time and then hide/unhide the buttons' panel each time using the setVisible() method of the panel

Related

(msaccess) Sync user scrolling across multiple pages/tabs/datasheets?

I have a form which contains multiple datasheet subforms, sorted into different pages of a tab control.
Each subform datasheet is based on an entirely different query, although in my case all subforms will always contain the exact same number of records as each other.
Question: Is it possible to programmatically capture user scrolling input (via keyboard, mousewheel, navigation buttons, or any combination thereof) and pass that information across subforms, so that, regardless of what the user does, whenever they switch pages/tabs, the same record number will always appear in row position one on every page/tab?
E.g. I have three subforms, each located with its own page control, and each underlying recordset has exactly 1000 records. A user scrolls down so that record # 575 shows in the first row of that page's subform. The user never actually selects any record, merely scrolls using mouse or keybpoard.
Is it possible to guarantee, that if the user switches to a different page/tab, that record number 575 of the corresponding recordset will show in the first row of the new page's datasheet?
There is no event to catch the scrolling itself, but you can control that the same current row id is visible in all subforms.
Full code and explanation including a working demo can be found and downloaded here:
Synchronizing Multiple Subforms in Access

How to find same logos, UI elements using sikulix

I am new to sikuli.
I am using it for functional test automation of my java spring standalone application. I am having the same set of images(logos) at multiple locations on the screen. and they are generated dynamically as per the application data. In that case how can I find and click on certain buttons/elements in the UI.
Example: like, share, comment text/image will be there several times in facebook page. in that how to we click on particular buttons out of all.(facebook is just an example) i want the similar solution for my application.
I think what you're asking is- given a case where the same image or UI element is present multiple times on the same page, how can I specify one of these elements in one location versus the same element in another?
The quick and easy way to do this would be to capture a larger picture, like as much of the window as you can, and click the image in parentheses after the click action; this opens a window reading file, matching preview, and target offset. Click target offset, use the mouse wheel to zoom in, and click on the exact point of the picture that you'd like to click.
It's possible to click in multiple places on a captured image, provided you use different click() commands, and you can set the target offset for each click() command without needing a new picture.
With just this one image, you can potentially click every square on the board provided you take the time to set the offset for each of the 64 click() commands it'd take to do so. http://files.chesscomfiles.com/images_users/tiny_mce/cigoL/Chessboard.png
The more difficult solution would be setting up regions, and searching those regions for the matching pictures, but for what you're looking for this should- for more about regions and setting it up check links below. Cheers!
http://sikulix-2014.readthedocs.io/en/latest/index.html
Based on your FB example you could use setROI() to focus on the top post on the page (imagine a rectangle that covers a complete post on the news feed) from there I would loop:
if exists(profile pic):
click(like button)
elif exists(profile pic 2): # If you are testing more than one user
click(like button)
else : type(Key.DOWN) #repeat as needed
Getting the next post into the ROI may be tricky but using WHEEL_DOWN may help if you can adjust your lines traveled with each wheel click on your system.

Initialising Neon-Animated-Pages

I am new to Polymer and I am struggeling to make a nice approach of an initialisation of a neon-animated wizard.
In my interface, the user should be able to register in different steps:
General Information (E-Mail, Username,...)
Personal Information (First Name, Last Name, etc...)
Other stuff...
Each time the user finishes one step, the wizard "slides" to the next step (with a neon-animation).
My problem is that I don't know how to reset the wizard when the user leaves the registration and comes back in. For instance, if I'm on step 2, leave the registration page and press the button"Register" again, the user is still on step 2. I want it to be step 1. It only works if I refresh the browser Window (Pressing F5).
I hope I could make it clear, posting code would just make it more difficult in my opinion.
When the register button is clicked, set the "selected" property of the "neon-animated-pages" to 0 (if you didn't set "attrToSelected") or to the value of your first page, that will transition to the first page.
Here's a quick example
http://jsbin.com/sulitowuge/edit?html,css,js,output

Hold data for list to add later?

So no SQL tables or anything here. Basically, I have 3 pages that have 6 items each. Each item consists of an image and then some text and also a smaller image than changes from a check to an "x" depending on if user selects or not. So if the image is checked, the user is adding that to a list which would display on a fourth page. This data needs to persist through just a session and if the session times out, then it resets. If the list is complete and on that fourth page the user choices to email or share list via social sharing, then the data would be gone after that action. What I am trying to figure out is the best way to approach and implement this with minimal time and effort as it has to go out quickly. Can any of you explain and maybe point to some links with info on the best way to achieve?
This is being done in asp.net web forms with html, css, and javascript.
Much appreciated!
You can use ViewBag() (for view in razor) or ViewData[] (for page in .net) to hold data for one web page.when you want it to other page. You can pass it to other page.
check this out
ViewBag, ViewData and TempData

incompatible type passed in as a parameter created by loading a GUI component.

I am having a problem with a UI that I am building in a Google Spreadsheet. I will First explain a little about how it works and than I will get to the problem. The UI is fairly simple program that connects to a SQL database, it allows users to create new records, Query, search, and render reports. I have created all the panels (eg the intro page, the create record) in the GUI builder. As the user navigates through the UI I swap out a Grid with the new panel that i want the user to see. For example on the intro page there is a create button when the user clicks the button the gird where there intro panel was is replaced by the create record panel. I have created two ways for the user query/search for data. The first way is to select a number range on the intro panel and click the Query button. This will than query the last 10 or so records into a GUI built Panel that I will call MainForm. The second way is to "search" for a job. On the intro page there is a search button when the user clicks with button it goes to a new page; the grid is switched to the search panel. On the new page/panel the user can put in some parameters to search for. After the user clicks the search button the program should load the search results into the MainForm in the same way as when you Query from the intro page. I have taken the whole function apart line by line, so i am sure that the issue has to do with loading the panel/Component. What i mean by that is these few lines of code.
var Component = app.loadComponent("MainForm");
var panel = app.createVerticalPanel().setSize("770px", "900px").add(Component);
app.getElementById("contentGrid").setWidget(0,0, panel);
But why would it load in one case, but not in another? Also it is not the method of loading the Component, rather it is the returning the panel/ Component.
To Summarize, When I load the Component with the query function it works, but when i load the Component in the search function I get and error: Incompatible type passed in as a parameter. Also I load the MainForm Component in two other functions as and it works most of the time, but some times I get the same error.
I think your approach is not ideal, load component is not supposed to be called multiple times. It would be far more efficient to get all your panels in the same compnent and play with visibility of each panel to show / hide them on demand. Each panel should be inserted in a vertical panel so that the "new panel" slips to its place when the "old one" hides.
An example of this approach is shown in this post to simulate tabs and could easily be adapted to your needs.
btw, this method is also very fast and responsive since the full UI is ready from the very beginning ;-)