Re: How to print a "!" to a text window?
- Hi Dave,
The following code was originally posted at
Open "TextEditor Exclamations Demo" For Text As #demo
#demo "!TrapClose [Quit]"
bang$ = "!!!!!!!!!!"
For i = 1 To 10
Call PrintTE "#demo", Left$(bang$, i) + Str$(i)
Print #demo, ""
Sub PrintTE Handle$, Text$
'-- PURPOSE: Prints text to text window or control regardless
' of exclamation chars at the start which could be interpreted
' as commands otherwise.
'-- NOTE #1: 'Handle$' must evaluate to a handle of a TEXT-type
' window or a TEXTEDITOR control.
'-- NOTE #2: Does not append newline to end of text.
bangs = 0
While Mid$(Text$, bangs+1, 1) = "!"
bangs = bangs + 1
If bangs Then
bang$ = Left$(Text$, bangs)
Text$ = Mid$(Text$, bangs + 1)
#Handle$ "!Lines ln"
#Handle$ "!Line ";ln;" ln$"
#Handle$ "!Select ";Len(ln$)+1;" ";ln
#Handle$ "!Insert bang$"
#Handle$ "!Select 1 ";ln
--- In firstname.lastname@example.org, "Dave Llewelyn" <meldavia@...>
> --- In email@example.com, "pendl2megabit"
> <pendl2megabit@> wrote:
> > >
> > > Hello all,
> > > After some head scratching with a mystery crash giving me the
> > > message "Runtime error, the collection is empty", I realize
> > > can't just print a single "!" to a text window. Is there a work
> > > for this? Is there any other print escape characters that are
> > > to give me another headache? Thanks for the help in advance.
> > > Cheers Dave.
> > >
> > Just to round the answers up:
> > 1) you can not print a single ! to a textwindow or texteditor
> > 2) you must preceed it with any character of your choice
> > 3) the ! at the beginning of a string send to the text control
> > signals LB, that a command is following
> > 4) there are no other characters that should lead to headaches
> > ---
> > Stefan Pendl
> > ___________________________________________________________
> > Telefonate ohne weitere Kosten vom PC zum PC:
> Thanks Stefan,
> Given that something must preceed the "!", is there any
> null character that can be sent that does not advance
> the cursor, or is there aything like backspace?
> (I tried quite a few things but it seems that anything
> unprintable is printed as a little box character).
> Thanks in advanc, Dave