1
votes

In Turbo Pascal 7 for DOS you can use the Crt unit to define a window. If you define a second window on top of the first one, like a popup, I don’t see a way to get rid of the second one except for redrawing the first one on top again.

Is there a window close technique I’m overlooking?

I’m considering keeping an array of screens in memory to make it work, but the TP IDE does popups like I want to do, so maybe it’s easy and I’m just looking in the wrong place?

1
This is not trivial to do from scratch (i.e. using the Crt unit as a basis). However, there are several open source libraries that provide such functionality. One example is Object Professional.500 - Internal Server Error
I will definitely try that out, thank you!Keith
@500-InternalServerError: I was about to suggest OPro, but its files seem to have been removed from SourceForge, unless I'm looking in the wrong place. The only place I could easily find which still has the files (incl the source of OPWindow.Pas, OpEntry.Pas, etc) is this one but I'm not sure about the legality of using it, tbh.MartynA
In this case I would not worry about legality as the library was released to the public domain and the company that made it has been defunct for close to 20 years.500 - Internal Server Error
Note that the Turbo Pascal IDE does not use Crt, but Turbo VisionMarco van de Voort

1 Answers

4
votes

I don't think there's a window-closing technique you're missing, if you mean one provided by the CRT unit.

The library Borland used for the TP7 IDE was called TurboVision (see https://en.wikipedia.org/wiki/Turbo_Vision) and it was eventually released to the public domain, but well before that, a number of 3rd-party screen handling/windowing libraries had become available and these were much more powerful than what could be achieved with the CRT unit. Probably the best known was Turbopower Software's Object Professional (aka OPro).

Afaik, these libraries (and, fairly obviously TurboVision) were all based on an in-memory representation of a framed window which could be rapidly copied in and out of the PC's video memory and, as in Windows with a capital W, they were treated as a stack with a z-order. So the process or closing/erasing the top level window was one of getting the window(s) that it had been covering to re-draw itself/themselves. Otoh, CRT had basically evolved from v. primitive origins similar to, if not based on, the old DEC VT100 display protocol and wasn't really up to the job of supporting independent, stackable window objects.

Although you may still be able to track down the PD release of TurboVision, it never really caught on as a library for developers. In an ideal world, a better place to start would be with OPro. It was apparently on SoureForge for a while, but seems to have been taken down sometime since about 2007, and these days even if you could get hold of a copy, there is a bit of a question mark over licensing. However ...

There was also a very popular freeware library available for TP by the name of the "Technojock's toolkit" and which had a large functionality overlap (including screen handling) with OPro and it is still available on github - see https://github.com/lallousx86/TurboPascal/tree/master/TotLib/TOTSRC11. Unlike OPro, I never used TechnoJocks myself, but devotees swore by it. Take a look.