Progress Indicator during Load Event - is it possible? - smart-device

Developing Smart Devices in Genexus. I am using the Load Event to load some hundreds of records (returned by a 3rd party webService) into the Grid (some rows might have different layouts).
When the user hits the search button, a ProgressIndicator is immediately shown (during the procedure execution). When the procedure ends (data retrieved), the ProgressIndicator disappears but it may take an additional 4-5 seconds for the Grid to show the fresh data.
This causes the user to think that there was a problem with the search. Then, unexpectedly, the grid refreshes.
Is it possible to, somehow, show a ProgressIndication during the Load or Refresh Events?
Or do you have any suggestions to prevent this behavior?

The main issue is that Refresh and Load events are "server" events in SD architecture so you don't have access to the device's APIs or resources like the Progress Indicator.
We had the same requirement in iOS and what we did was using the GXRefresh event.
Event 'gxrefresh'
Composite
//Your code. Example: ProgressIndicator.Hide()
EndComposite
EndEvent
Gxrefresh is a Local event that is executed after the Refresh and Load. Is a hidden event that helped us accomplish this. (This is not an official event and it can be taken out in any version of GeneXus)
So the solution is:
Start a Progress Indicator on the ClientStart event of that Panel.
Hide the Progress Indicator on the 'gxrefresh' event of that panel.
Note: Remember that in order to use the gxrefresh event you will need to add a hidden button named 'gxrefresh'. You can hide that button as you will not need it in the UI (we put it Visible=false on the application bar).
If that solution for any reason is not possible (for example the gxrefresh event is deprecated or you are developing for Android) I can think of a second WA that is not elegant at all but should work.
Start the Progress Indicator in the Client Start Event of the panel
Put a hidden variable with control type SD Chronometer.
Set the timer for 6 seconds
Stop the Progress Indicator on the Tick event of the SD Chronometer and stop the Chronometer so the Tick event is not executed any more.
These are the two options I can think of.
Maybe there is an easier way but I haven't heard of it. A Grid.DidLoad event would be great for this scenario. For sure we will have this soon or some other solution for this problem.
Links:
SD Chronometer: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?25058
SD Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?17042
Server Side Events: http://wiki.genexus.com/commwiki/servlet/hwikibypageid?24234

Related

Delphi: scrolling whilst running real time

I have implemented a Scroll box that dynamically adds TCharts dependent on the number of channels available on an input device. The charts repaint on a loop to show the value of the voltage through the channel, so that the display outputs effectively a "real-time" view of the voltages being applied to each channel.
Currently I have an Application.ProcessMessages function to prevent the application becoming unresponsive during a run, but I would like to be able to scroll through the box whilst the channels are being displayed, without disturbing the display, which currently pauses whilst the scroll bar is clicked.
Is this possible?
Yes, this is possible.
The charts repaint on a loop ...
Repaints driven by an own loop indeed ensures respiratory distres on the system, which exactly is the reason for the need of Application.ProcessMessages. Try not to use it. Instead, you should just ask the charts to repaint themselves with Invalidate when new data comes in, and let the system decide when it is convenient to do so.

How to get textfield value in App Inventor without form submission?

I want to know the event in blocks section using which the entered text value can be obtained without a form submission through button.
Let's say user inputs text in mobile phone through keyboard and presses enter. In this case I want some event to trigger and get the value that user entered.
There are 2 events available like lostfocus and gotfocus.
Will these work? Or is there any other good approach for getting text value on pressing enter?
Unfortunately there is no such event like OnEnterPressed available in MIT App Inventor and the events LostFocus and GotFocus will not work in this case.
What you currently can do is
use a button and use the Button.Click event, or
create your own custom keyboard, see also this example
Currently there is a limitation for App Inventor extensions, which only can be used for non-visible components. Later as soon as also visible components are doable, then you could write your own textbox extension and add an event yourself.
Edit concerning the new question in the comments about different screens:
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed...
You can insert a Clock component that monitors the TextBox1.Text. When it triggers, it checks if the TextBox1.Text has changed and saves it to a variable. When it triggers again, it compares the variable with TextBox1.Text. After the user finishes typing, the variable and TextBox1.Text will be equal and then you can trigger the event like you eanted when the user pressed Enter.
Hope this helps!

Ranorex v5.0 doesn’t click button sporadical

I have a ranorex project, which automated an use case with clicking 5 buttons in an application.
To set up this project I used the record function. I defined some sleep times between the clicks.
The run with the clicks is in a loop, where the loop count is dynamically defined. One button of the five and always the same button, Ranorex "ignores" sometimes. According to the log file, the button is visible and enabled and ranorex also runs the code with the Click(), but the application doesn’t receive the click. Before in code the click is called, I check with an “If” whether the button is visible and enabled - and if the click() is called (or doesn't), I log it to ranorexlog. Sometimes the application is running through and all the clicks work and sometimes this button click is missing one or more times. It doesn’t depend on the sleep time between the clicks, because I tried long and small pause times. It doesn’t depend on the focus of the application, too, because I switched the focus several times.
Does anybody know this problem, workarounds or what I’m doing wrong?
the obvious workaround is to use Mouse.Click("{Button}") with a 0 duration rather than invoking the click event, or if you are invoking the mouse click invoke the buttons click action. (sorry since they are both named Click() i don't know which one you are using).
As to what is happening, from your description it sounds like your script is finding more than one element with the same xpath. This would cause issues with the click event because it may try to click on the element, but it's the first xpath that matches not the second. Are there any optional elements in this sequence of button clicks that appear? for instance a busy spinner with inner text of "OK" that is hidden from view when you are clicking a button on a form with inner text of "OK" would cause two elements to be found if the xpath was looking for an inner text of ok. This element that is causing may not have been caught in the recorder because it might not have been present at the time.
Another possibility if you are using Mouse.Click() (particularly if this is a website)is that it is possible your button is not actually on the screen, I know that should be taken care of by the visible check but it is visible on the dom even though it is not visible on the screen that causes issues.
I highly recommend do not use the recorder to create test suites that need to be re-runnable. It would actually be better to use the spy tool to create a repository or several repositories for the product you are testing, this way you can be sure the xpaths are all unique, which using the recorder there is no gaurantee. You can actually record with the created repository, and ranorex will attempt to find item in the repository before creating a new item, so the recorder will use this repository when creating recordings.

What is the equivalent of Android Toast in RIM?

In android, there is a function call Toast and it show instantly without involve in time. I tried to use Status in RIM but it must run in the invokeLater and cannot set the time less than 1 second. So it cannot display instantly.
Any other built in that same with Toast or Status?
No there is not afaik. Toast was "invented" in a way by Android.
Previous OS's have used popup boxes with confirmation buttons. A Toast is almost like a popup box with a timer attached to it.
Of course, #Signare gives the common replacement correctly for what you would "normally" do on BlackBerry. Dialog.alert(String)
If you want something more "Androidy", this is something we want to implement at Cobi, but have not gotten around to yet due to time constraints working on client work.
There are 2 unique aspects to a Toast compared to the "old" way of doing things:
the popup only shows for a short time
the popup does not block the user from interacting with the background screen at all
To create the popup screen, look at the PopupScreen class - and you pass in a layout manager of your own that will be displayed.
You could start a timer when the screen is shown (we have not implemented this yet) and that could close the screen for you.
As far as not blocking the user - this is the major difference - and I do not know if it can be done if you use the PopupScreen class. Perhaps if your PopupScreen passes all keypresses through to the underlying screen, this may be possible.
In some of our apps, we have a custom field, defined in our base MainScreen subclass, that can be positioned over the rest of the fields on the screen. This allows the user to continue interacting with the screen while the field is displayed. I cannot share that code at the moment here.

detecting notificationbox close event - firefox addons

We are using to display custom notifications for a
Firefox addon. All is good, except that we also need to do some custom
cleanup activity when the user presses the red [x] button (in Windows)
on the right side of our notification bar to close it (or technically
"hide" it).
That said, what would be the best way to detect or get an indication
that the user has pressed the red [x] button to close/hide the
notification?
There is this event AlertClose as the document say but how to handle it?
i tried this but no effect..
notificationobj.addEventListener('AlertClose',function() { alert('closed'); },false)
The bad news is the "AlertClose" is only fired in Firefox Mobile. We should move the event to the toolkit so all apps get the support. I don't have any good ideas, except using a DOM mutation event to watch for "DOMNodeRemoved".

Resources