04-22-2024, 02:25 AM
(This post was last modified: 04-22-2024, 02:28 AM by PhilOfPerth.)
The Site Suggestions area presumably is to suggest changes to the site layout. It doesn't seem to cover suggestions about improving the language - adding, removing or changing functions etc. Is there, or can there be, an area that does this?
Here's an example of what I meant in the previous post:
I often need to clear one or more lines of my screen during programme running – prompts, warnings etc. or to centre text on a selected column. Are there functions for either of these? I’m sure if there aren’t, someone could write one and include it in the PE list of functions. I have been using the two Subs below, which both work for any screen-size setting with a Monospace font.
(CPL is CharsPerLine of the set screen size : CPL = Width / _PrintWidth("X"), and LN$ is a string of 2-digit line numbers).
We can write Locate line-number,1 : Print space$(80) or whatever the line-length is, repeatedly, to clear each line, but it’s easier to use and visualize: Wipe “080910” (to clear rows 8, 9 and 10) with this sub:
Sub WIPE (ln$) ’ To clear selected screen rows
‘ Call this sub with a string of 2-digit row-numbers e.g. Wipe ”080910” for rows 8, 9 and 10
If Len(ln$) = 1 Then ln$ = "0" + ln$ ' catch single-digit line numbers
For a = 1 To Len(ln$) - 1 Step 2 ‘ step through LN$ in 2 digit steps
wl = Val(Mid$(ln$, a, 2)) ’ line to be wiped is value of the 2 digits
Locate wl, 1: Print Space$(CPL)’ print a full line of spaces
Next
End Sub
And we can use LeftPos=80-int(len(txt$)/2) : Locate line-number,LeftPos : Print Txt$ to centre a line of text, but it’s
simpler to write: Centre txt$ , 10 (to centralize Txt$ on line 10) with this sub:
Sub Centre (txt$, linenum)
‘ Call this sub with a text string and line-number e.g. Centre Txt$,10
CtrPos = Int(CPL / 2 - Len(txt$) / 2) + 1
Locate linenum, CtrPos
Print txt$
End Sub
They’re both very primitive, but I think the general ideas, cleaned up, could be useful to others.
Here's an example of what I meant in the previous post:
I often need to clear one or more lines of my screen during programme running – prompts, warnings etc. or to centre text on a selected column. Are there functions for either of these? I’m sure if there aren’t, someone could write one and include it in the PE list of functions. I have been using the two Subs below, which both work for any screen-size setting with a Monospace font.
(CPL is CharsPerLine of the set screen size : CPL = Width / _PrintWidth("X"), and LN$ is a string of 2-digit line numbers).
We can write Locate line-number,1 : Print space$(80) or whatever the line-length is, repeatedly, to clear each line, but it’s easier to use and visualize: Wipe “080910” (to clear rows 8, 9 and 10) with this sub:
Sub WIPE (ln$) ’ To clear selected screen rows
‘ Call this sub with a string of 2-digit row-numbers e.g. Wipe ”080910” for rows 8, 9 and 10
If Len(ln$) = 1 Then ln$ = "0" + ln$ ' catch single-digit line numbers
For a = 1 To Len(ln$) - 1 Step 2 ‘ step through LN$ in 2 digit steps
wl = Val(Mid$(ln$, a, 2)) ’ line to be wiped is value of the 2 digits
Locate wl, 1: Print Space$(CPL)’ print a full line of spaces
Next
End Sub
And we can use LeftPos=80-int(len(txt$)/2) : Locate line-number,LeftPos : Print Txt$ to centre a line of text, but it’s
simpler to write: Centre txt$ , 10 (to centralize Txt$ on line 10) with this sub:
Sub Centre (txt$, linenum)
‘ Call this sub with a text string and line-number e.g. Centre Txt$,10
CtrPos = Int(CPL / 2 - Len(txt$) / 2) + 1
Locate linenum, CtrPos
Print txt$
End Sub
They’re both very primitive, but I think the general ideas, cleaned up, could be useful to others.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.)
Please visit my Website at: http://oldendayskids.blogspot.com/
Please visit my Website at: http://oldendayskids.blogspot.com/