From: Charles Harris
Here's an alternative approach to customizing help screens. I have
the following macros in my tsestart.s, so when I press f1 (with cursor
on or right after a word) it looks in my own helpfile for that word
(surrounded by ='s). If not found, it looks in the standard TSE Pro
helpfile. If still not found, it looks in the TSE Pro help index. If
found in my own helpfile, another f1 press takes me to the standard TSE
Pro helpfile (and then another f1 takes me to Help on Help, because I
can never remember how to copy a help screen). Pressing ESC steps me
back to where I came from.
When the word is found in my own helpfile, I am sitting in the familiar
TSE edit environment. So I can immediately make any changes, search
for other things, copy blocks, open windows, etc.
Here are some of the advantages of this approach:
1. Although the TSE help screens are the best I've seen, for a person
like me with no programming experience they are sometimes overkill and
sometimes underkill. I usually want less detail and more (or simpler)
examples. So when I finally figure out what I need to know about a
given command, I quickly enter a summary into my own helpfile. Or I
may just copy the entire TSE help screen, and edit it later.
2. TSE's See Also's sometimes don't include the ones I need to see.
3. I need help with nonexistent commands (e.g. GetLine) or ones that
I always spell wrong (e.g. iff). I can store an unlimited number of
alternate spellings or mnemonics or related terms. (To get help on
a bogus command or a keyword, I just type it wherever I happen to be,
then press f1.)
4. If I fail to find what I'm looking for on the first try, when I
finally find it I add my first-try search term so I will find it
quickly the next time.
5. I can enter topics that are not treated (or not segregated) in TSE's
help (e.g. how do I know if I've reached the end of a line?).
6. I can easily incorporate helpful info from other sources, such as
this mailing list.
7. I can incorporate my own info in whatever layout I prefer (e.g. a
multicolumn list of my key assignments or macros).
8. Doing a global search in my own helpfile is quicker and less
disorienting than a search in TSE's help.
9. I can keep the help visible in one window while working with a
file in another window.
Below are the macros, plus a few selections from my own helpfile to
illustrate the different useful things that can be done. Note the
various key assignments, which can bypass my own helpfile and jump to
the TSE help Table of Contents, info on Control Statements, or a list
of key assignments. (I have to admit, though, that I never remember
to use any of those keys. Usually repeated f1's and the keys at the
bottom of each TSE helpscreen get me where I want to go.)
--Charles Harris xchar@worldnet.att.net
// ==================================================================
string proc GetWordAtCursor()
string word[80] = ''
PushPosition()
PushBlock() // Save current block status
if MarkWord() or (Left() and MarkWord()) // Mark the word
word = GetMarkedText() // Get it
endif
PopBlock() // Restore block status
PopPosition()
return (word) // That's all, folks!
end GetWordAtCursor
proc EditMyHelp()
EditFile("c:\tse\help\myhelp.hlp")
end
proc HelpOnWordAtCursor()
Help(GetWordAtCursor(),1) // goto SemWare Help Index if not found
end
keydef EndHelp
HelpOnWordAtCursor()
EndProcess()
end
Proc PauseHelp()
if Enable(EndHelp,_DEFAULT_)
Message(" in my own Help.... press ESC to continue")
set(StatusLineUpdating,OFF)
Process() Disable(EndHelp)
set(StatusLineUpdating,ON)
endif
end
proc MyHelp() // Find =word= in my own helpfile
string word[20]="", linkend[25]=""
integer textcolor, cursorcolor
PushBlock() // in case a block is
marked
word=GetWordAtCursor() PushPosition()
linkend= "=" + word + "=" // ie: find =word=
EditFile("c:\tse\help\myhelp.hlp")
if lFind(linkend,"ig")
AddHistoryStr(word, _FINDHISTORY_) // so PrevHelp will work
cursorcolor=query(cursorAttr) // save colors, to restore later
textcolor=query(TextAttr)
set(TextAttr,color(White on Blue)) // colors for help
set(cursorAttr,color(Bright Yellow on Blue))
UnmarkBlock() Right()
ScrollToRow(3) UpdateDisplay()
PauseHelp()
PopBlock() // restore colors and any marked block
set(cursorAttr,cursorcolor)
set(TextAttr,textcolor)
PopPosition()
else // if not found in my own helpfile, goto SemWare's
PopPosition()
HelpOnWordAtCursor()
endif
end
MyHelp() // look in my own helpfile first
EditMyHelp() // edit my own helpfile
Help("Table Of Contents")
Help("Control Statements")
Help("Key Assignments")
PrevHelp()
// ==================================================================
/* Caution: The items below are for illustrative purposes only.
The information (though useful to me, and perhaps to you too) may be
incomplete, misleading, or even incorrect!
--Charles Harris xchar@worldnet.att.net
=keys= =ShiftShift= =CtrlAlt= =CtrlShift= =AltShift=
(not: =AltCtrl= =ShiftCtrl= =ShiftAlt=)
Combinations like will work for most keys, but maybe
not for some. Use potpourri showkeys to test which ones.
=PlaceMark= =GotoMark= =bookmark=
From: STEVE KRAUS Number: 5517
Subj: UnDocumented SC Commands Conf: 16
Date: 07-12-95 Time: 23:07
String values from "1" to "99" can be used, as in PlaceMark("43") and
GotoMark("43"), in addition to "a" to "z".
=substring= (=slice=) =substr=: alternative notations:
piece = longstring[3..7] // 3rd thru 7th chars of longstring
or: piece = longstring[3:5] // = 5 chars, starting at 3rd
or: piece = SubStr(longstring,3,5) // ditto
piece = longstring[length(longstring):1] // last character
=case= =when=
string fruit_name[10] Upper(fruit_name)
integer a
case fruit_name
when "APPLE" somecommand() // quotes needed
when "MELON", "PEAR" somecommand() Left() Down()
otherwise somecommand()
endcase
case (a) // parentheses are optional
when 1..10 Message("It's 1, 2, 3,...or 10")
when 15, 20, 25 Message("It's 15, 20, or 25")
endcase
[see also: getkey]
=if= =elseif= =else=
if n and m commands
elseif i == 10 commands
elseif a 0 commands
elseif a >= 2 commands
elseif not isCursorInBlock() commands
else / commands
endif
=iif= (not: =iff=)
iif(condition, expression2, expression3):
If condition not 0 (i.e. is TRUE), returns expression2.
Otherwise, returns expression3. e.g.:
Message(iif(nnn 0, "not zero", "Zero"))
is equivalent to:
if nnn 0
Message("not zero")
else
Message("Zero")
endif
=Relational= operators: == >=
(same for numbers or strings)
"def" < "abcd" is true, because fewer letters
"DEF" < "def" is true, bcs ascii D < d & same no. of letters
=and= =not=
To determine if Insert is ON and Wordwrap is OFF:
Query(Insert) and (not Query(WordWrap))
=quote= =quotation=
To include a " in a string, use ' around the string.
To include a ' in a string, use " around the string.
(No way to include both " and ' ???)
=termination= =end= =quit= =exit=: use break, return, or halt:
=break= [note: no parentheses!]
break immediately terminates a loop, while or repeat.
Goes to the statement following the end of the loop.
=return=: [note: MUST have parentheses, even if empty! return()]
return() immediately terminates the loop AND the current macro.
Goes to the calling routine (i.e. macro or just the editor).
=halt= [note: no parentheses!]
halt terminates ALL macros and goes back to the editor.
Use only while debugging!
(because leaves editor in unknown state)
Getting user =input= =Get=
=Ask= pops up a prompt box, gets whatever user types in, up to
or . (History optional.)
Ask("Which file?: ",filnamstring)
Ask("Search for:", needle, _FIND_HISTORY_)
=Read= No prompt. Gets user's input as typed at the current
video output position (e.g. in a data entry screen or a custom
dialog box--see PopWinOpen). See tse.ui for examples.
=GetKey= returns the next keystroke (e.g. to branch on).
[ =GetLine= =GetChar= : no such command ] use =GetText= or =GetWord=
WholeLine=GetText(1, CurrLineLen()) [1=col. to start with]
firstchar=Substr(WholeLine,1,1)
GetWord(1) will get previous word if cursor is on space.
See Also: GetMarkedText(), CurrChar()
=eol= =endOfLine= =CurrPos= =CurrLineLen= =CurrChar=
TRUE when cursor is exactly at end of current line
(i.e. one char to right of text):
if CurrChar() == _AT_EOL_
TRUE when cursor is at or beyond end of current line:
if CurrChar() < 0 (yup)
or: if CurrPos() > CurrLineLen()
TRUE when cursor is within the text of current line:
if CurrChar() >= 0
or: if CurrPos() <= CurrLineLen()
TRUE when cursor is on an empty line:
if CurrLineLen() == 0
=nonascii= =non-ascii= =nonalph=
=odd= =oddchars= (actually, non-alphanumeric)
Search for: [~!-~ ] gx
=help= =helpkeys=
MyHelp() // look in my own helpfile first
EditMyHelp() // edit my own helpfile
Help("Table Of Contents")
Help("Control Statements")
Help("Key Assignments")
PrevHelp()
*/
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|