Hi,
Got one more question for the week, and that should be enough to play with for the next few days, and learn by trial & error.
I'm trying to build a function similar to the Windows console FillConsoleOutputCharacter(). We have the method of getting the maximum number of characters in a row, the column width ; but I can't locate the function that returns the maximum number of rows, the height.
I think I saw it a couple of days ago, but cannot locate it anymore.
- Thomas Linder Puls
- VIP Member
- Posts: 1430
- Joined: 28 Feb 2000 0:01
Re: Row equivalent to getConsoleWidth()
I don't know how to get the number you are looking for (and I don't even thing the Width is necessarily what you are looking for either).
A console has a Window which shows part of the Screen Buffer:
The Width you can get is the Screen Buffer Width (which in Windows 10 is the same as the Window width, but in earlier versions of Windows I remember that the numbers could differ).
Similar to that number you can could also obtain the Screen Buffer Height, but that is most likely not at all the size of the window.
A console has a Window which shows part of the Screen Buffer:
The Width you can get is the Screen Buffer Width (which in Windows 10 is the same as the Window width, but in earlier versions of Windows I remember that the numbers could differ).
Similar to that number you can could also obtain the Screen Buffer Height, but that is most likely not at all the size of the window.
Regards Thomas Linder Puls
PDC
PDC
-
- Active Member
- Posts: 25
- Joined: 6 Aug 2012 16:56
Re: Row equivalent to getConsoleWidth()
Thanks Thomas,
I'm familiar with the Properties dialog, but don't know how to get the maximum number of rows programatically. This is clear in other languages ; sometimes it's something like MaxColumn() and MaxRow() or something similar.
If we're doing a grid for example, we need to know the maximum **visible** number of rows, so that it can be scrolled down.
I'm familiar with the Properties dialog, but don't know how to get the maximum number of rows programatically. This is clear in other languages ; sometimes it's something like MaxColumn() and MaxRow() or something similar.
If we're doing a grid for example, we need to know the maximum **visible** number of rows, so that it can be scrolled down.
- Thomas Linder Puls
- VIP Member
- Posts: 1430
- Joined: 28 Feb 2000 0:01
Re: Row equivalent to getConsoleWidth()
As mentioned there is no function for this in the console class (I am not sure why not, I have added one for future releases).
This is trivially similar to getConsoleWidth:
But that does not help you in your version.
The recommended way to deal with modifications to pfc, is to have some directory which shadows the official pfc directory and place modified files there:
This is trivially similar to getConsoleWidth:
Code: Select all
clauses
getConsoleWidth() = Columns :-
bufferInfo(coord(Columns, _) | _) = getConsoleScreenBufferInfo().
clauses
getConsoleHeight() = Rows :-
bufferInfo(coord(_, Rows) | _) = getConsoleScreenBufferInfo().
The recommended way to deal with modifications to pfc, is to have some directory which shadows the official pfc directory and place modified files there:
- you place a copy of console.cl and console.pro in <myPath>\pfc\console and
- make <myPath> an include directory (in Project -> Settings -> Directories -> Include Directories) higher in the list than $(ProDir) (but lower than ".").
Regards Thomas Linder Puls
PDC
PDC
-
- Active Member
- Posts: 25
- Joined: 6 Aug 2012 16:56
Re: Row equivalent to getConsoleWidth()
Perfect, thanks Thomas.