Feature #4472
Allow pause for a fraction of a second
100%
History
#1 Updated by Vladimir Tsichevski over 4 years ago
Presumably since OpenEdge 11.3.0, "the PAUSE statement was enhanced for a whole or a fractional time-out interval in seconds. When the time-out period is a fractional value, it is rounded to the nearest whole millisecond.".
The similar behavior need to be implemented in FWD.
#2 Updated by Greg Shah over 4 years ago
This is not hard to implement in FWD.
The PAUSE
statement, READKEY
and the WAIT-FOR
statement all have this change. All of them should be updated accordingly to handle double
instead of int
. The link between these will be explained shortly.
PAUSE
is implemented in static method calls logicalTerminal.pause()
and LogicalTerminal.pauseBeforeHide()
. Both of these already can accept a decimal
and double
type. These in turn call down to the following LogicalTerminal
worker methods:
private static void pauseWorker(int seconds, String text, boolean noMessage, handle hWin)
public static void pauseBeforeHide(double seconds, String text, handle hWin)
WAIT-FOR
is implemented as static method calls to LogicalTerminal.waitFor()
which can handle decimal
and double
. It calls the LogicalTerminal
worker:
public ScreenBuffer[] waitFor(EventList wc, int focusWidgetId, int seconds, ScreenBuffer[] inbuf)
READKEY
is implemented as static method calls to KeyReader.readKey()
which can take decimal
and double
. In turn, these call LogicalTerminal.readKey(int)
or Stream.readChar(int pause)
.
All of these call to the FWD client for actual implementation, because there is a tight coupling of this feature with the UI. This is not just a simple sleep()
.
On the client side (see ClientExports
and ThinClient
) these are the API methods that get called:
public int pause(int seconds, String text, boolean noMessage, int windowId)
public void pauseBeforeHide(int seconds, String text, int windowId)
public int readKey(int seconds)
public ScreenBuffer[] waitFor(EventList wc, int focusWidgetId, int seconds, ScreenBuffer[] inbuf)
This change must flow through the downstream usage as well. In the ThinClient
, the private Event waitForEvent(int seconds, boolean frameAsTarget, boolean honorServerEvent, boolean includeOSEvent)
is used for all of the above (except for the Stream
case). In turn, this depends on TypeAhead.getKeystroke(int)
which takes a milliseconds value.
The actual waiting is only done in 2 places. If the double
is passed through to ThinClient.waitForEvent()
and Stream.readChar(int pause)
, I think the rest will work automatically.
No conversion changes are needed.
#3 Updated by Constantin Asofiei over 4 years ago
- Status changed from New to WIP
- Assignee set to Constantin Asofiei
- Start date deleted (
12/11/2019)
I plan to use a legacy-system/wait-millis=true
flag (in the directory.xml) to determine if READKEY and PAUSE will use the milliseconds. This rounding is done on server-side and client-side will be called with millis.
#5 Updated by Greg Shah over 4 years ago
Greg Shah wrote:
- This use of
PAUSE <milliseconds>
is not currently supported. See #4472. The changes described there should be implemented.Constantin wrote:
PAUSE <millis>
is a OE 11.3 feature - if we implement it, we should activate it conditionally.Greg Shah wrote:
I'm OK with this. We can handle the rounding vs preservation of the fractional part in the server and always pass millis value down to the client. I think we need to go ahead and implement this.Constantin wrote:
I plan to use a legacy-system/wait-millis=true flag (in the directory.xml) to determine if READKEY and PAUSE will use the milliseconds. This rounding is done on server-side and client-side will be called with millis.
I prefer to check the Progress version number and automatically implement this if 11.3
or later. I don't want to add extra configuration where we can make a good default instead.
#6 Updated by Constantin Asofiei over 4 years ago
Greg Shah wrote:
I prefer to check the Progress version number and automatically implement this if
11.3
or later. I don't want to add extra configuration where we can make a good default instead.
You mean from p2j.cfg.xml
? I don't recall having this saved in the directory. And p2j.cfg.xml
is usually copied into the application jar only if runtime conversion is in use.
Also, my idea is for the ClientExports APIs to receive a millisecond value instead of seconds (as a double).
The server side will either round the received seconds or not, depending on that flag.
We need to adapt also the status message (for i.e. PAUSE) to reflect the millis, if they exist (3 decimals max).
#7 Updated by Constantin Asofiei over 4 years ago
CHOOSE ... PAUSE n
also uses fractional seconds as millis.
#8 Updated by Greg Shah over 4 years ago
You mean from p2j.cfg.xml?
No, this is runtime only. I was thinking of EnvironmentOps.getVersion()
, which can read a version string from the directory but defaults to "11.6" at this time.
#9 Updated by Constantin Asofiei over 4 years ago
Greg Shah wrote:
You mean from p2j.cfg.xml?
No, this is runtime only. I was thinking of
EnvironmentOps.getVersion()
, which can read a version string from the directory but defaults to "11.6" at this time.
OK, I'll use that and configure other projects with this setting.
#10 Updated by Constantin Asofiei over 4 years ago
- Status changed from WIP to Review
- % Done changed from 0 to 100
This is fixed in 4335a rev 11412. Please review.
#11 Updated by Jurjen Dijkstra over 4 years ago
It is probably none of my business but I wonder why it is so complicated. PAUSE 1 is 1000 milliseconds, PAUSE 1.0 is also 1000 milliseconds and PAUSE 0.1 is 100 milliseconds. So I would think there are two overloads: one with an integer parameter and one with a double parameter, they both simply multiply by 1000 to get the number of milliseconds. I find it peculiar that the fractional part performs on the server and the millis on the client, why not just in one place? But like I said, it is none of my business really
#12 Updated by Constantin Asofiei over 4 years ago
Jurjen Dijkstra wrote:
I find it peculiar that the fractional part performs on the server and the millis on the client, why not just in one place?
The client is not receiving just the fractional part, it will receive the seconds converted to milliseconds (i.e. for a 1.9 seconds on server-side, client-side will receive 1900 millis).
#13 Updated by Greg Shah over 4 years ago
- Status changed from Review to Test
Code Review Task Branch 4335a Revision 11412
The changes are good.
The next time we have this requirement (to check a version number at runtime), we really should move the version number comparison code into a helper method of EnvironmentOps
. But we will probably forget that we have it there. I worry that we will duplicate that comparison code in many places.
#14 Updated by Greg Shah over 4 years ago
- Status changed from Test to Closed
Task branch 4335a was merged to trunk as revision 11345.