How to wait for some key in the Obey file? (riscoscloverleaf)
Sergey Lentsov (8268) 63 posts |
Hello, I would like to show some information to user before launch main program. I tried to use the “*Error” and my info displayed but Obey file exited and my app does not started. Is there any solution how to wait for some key? Even MS-DOS have “pause” command… |
David J. Ruck (33) 1635 posts |
There’s a OSSWICalls module which can call any SWI from the command line, you could use that to do an INKEY equivalent. Don’t ask where it lives these days, you can google just as well as me. |
Sergey Lentsov (8268) 63 posts |
@DavidS Thank you for solution with Basic. |
Andrew Rawnsley (492) 1445 posts |
In case it helps, I noticed that *pointer 1 (turn on pointer) in an obey file leads to a “press space or click mouse to continue” message, which surprised me. |
Sergey Lentsov (8268) 63 posts |
@Andrew Rawnsley Thank you very much for your answer, it is exactly what i need! |
David J. Ruck (33) 1635 posts |
I would not rely on that behaviour surviving, sounds more like a bug to me! |
Ronald (387) 195 posts |
I recently made a sharedClib binary that takes input from the keyboard and creates a system variable. |
Steve Pampling (1551) 8170 posts |
Command line WaitUntil a specific condition is matched? Sounds like WaitUntil by Vince Hudd to me. No bug effects required. |
Vince M Hudd (116) 534 posts |
WaitUntil doesn’t offer waiting for a key to be pressed as an option, though – and it’s not something I will be adding. The point of the program is to pause the execution of an obey file, while allowing the system to carry on multitasking – and that means normal operation of the computer should be able to carry on as, well.. normal. That could include loading a text editor and typing. i.e. pressing keys. If Sergey definitely wants to wait for a key press, then his best option is either to use a BASIC program to wait for a key, as DavidS suggested (and stop the whole desktop in the process) or to go a little further and write the BASIC program as a multitasking one, display the text via the application in a window, and prompt the user to respond within the context of the program (e.g. click on a button). If the latter, why not build that into the main program itself? |
Steve Fryatt (216) 2105 posts |
…open and maintain a Hotkey window…
…close the Hotkey window…
|
Stuart Swales (1481) 351 posts |
Exactly as Steve (F) says. Plenty of RISC OS applications have Splash-type screens that you can crib from. |
Steve Pampling (1551) 8170 posts |
You know how you have those occasions when you know the subject came up before and one particular offering comes to mind – that was Vince’s offering. There are other items and one seems to be what Sergey is asking for and that’s Pause The only question I really have is why hasn’t this kind of feature been added to the OS years ago? |
Raik (463) 2061 posts |
I use something like this if I need …
|
Vince M Hudd (116) 534 posts |
Yes, a splash screen is a good example of more or less what I was hinting at, in particular with the suggestion to possibly build this initial information to be displayed and the pause into the main application. However, thinking about it, I do have a vague recollection that at one point someone released a command line splash screen program. i.e you could call it from a !Run file with arguments pointing at whatever you wanted displayed, etc. In slightly unrelated news, I’ve just uploaded a “new” build of WaitUntil. I’ll deal with the announcement over the weekend. (New = a 2017 version that never got uploaded, but I’ve tweaked the licence and version report.) |
Steve Pampling (1551) 8170 posts |
You were probably short of circular tuits at the time. |
John WILLIAMS (8368) 493 posts |
Probably because, as remarked elsewhere, it’s better done within the program itself! However, this seems to work more-or-less in BASIC waiting for the SPACE bar:
Doubtless it’s very imperfect! |
Steve Pampling (1551) 8170 posts |
That’s the kind of logic that leads to using bespoke routines in each program instead of shared libraries. |
John WILLIAMS (8368) 493 posts |
I refer you to my TaskCheck BASIC utility to assure you that this is not “my logic”, but practically splashscreens have been so implemented in the past! |
Steve Fryatt (216) 2105 posts |
From the BBC BASIC Reference Manual, p7: If you … write a window managed program you must … avoid instructions in BASIC which will … interfere with the running of other programs under the Wimp. |
Steve Fryatt (216) 2105 posts |
I would like to show some information to user before launch main program. So far, no-one seems to have addressed the fact that this feels like a really bad thing to want to do (which is, perhaps, why there’s no way to do it). It’s very definitely not the way that a user would expect an application to operate1. It sounds as if what is required is to pop up a splash screen which closes when the user clicks on it (perhaps on an “OK” button at the bottom). You would do it using a normal window, with the appropriate “on top” flags set, once the application has started up – and track the state internally. That said, didn’t RISC OS Developments do something like this for a browser and make the code available for others? I can’t find the search terms just now, but I seem to recall a download from the ROD website? 1 Assuming that we’re talking about multitasking software here. If we’re talking about “single-tasking, take over the screen” stuff, then |
John WILLIAMS (8368) 493 posts |
Told you it was imperfect! |
Steve Pampling (1551) 8170 posts |
If you want to say what the user can or cannot do then we are most definitely back to the discussion about OS security |
Steve Fryatt (216) 2105 posts |
Not really. Since we’re talking about Cloverleaf (see the thread title), one would hope that Sergey was planning to write something that complied with normal Style Guide expectations… |
Vince M Hudd (116) 534 posts |
That depends if you count comments which require a bit of reading between the lines.
I thought someone had written a little splash screen type app, but thought that it was a very long time ago. However, my perception of time might be a bit off kilter this year. OTOH, if ROD had released something along those lines, wouldn’t Andrew have mentioned it when he commented in this thread? |
Steve Fryatt (216) 2105 posts |
You’d have thought so, but who knows? I suddenly had inspiration on how to search for it, so… It was called BannerLoad — available free of charge on request, apparently. |