//
// INLINE-HELP.VDM Ch. Ziemski 09.06.2002
// 14.03.2004
//
//
// -- Inline documentation -- (could be displayed with Shft-F1)
//
// *** INLINE-HELP - A demo for implementation of inline online help ***
//
//
// This is the main macro documentation and online help in one instance.
//
//
//
// ----------------------------------------------------------------------------
//
// Shft-F1 : show this help
//
// F11 : whatever command etc.
//
// ------------------------------------------------------------------------------
//
// Here is an example:
// --------------------
//
// Here could be an example
//
//
//
// some more internal comments
//
// ....
// .....
//
//================================================================================
Key_Add(`Shft-F1`, `[VISUAL EXIT] CALL(100, "HELP") `, OK)
// Here comes your macro code ...
//
// ....
//
return
//=========================================================================================
// Show some help instructions (the inline doco from top of the macro)
:HELP:
Config(CM_E_UNDO,0)
Key_Purge()
Win_Clear
#103=Buf_Num
Buf_Switch(XBUF1)
Reg_Ins(Macro_Num)
BoF
Search("|H3CDOC>", NOERR) // the leading "<" is masked out intentionally!
if(EM){
Message("\n\n No inline help found.")
}else{
Line(1)
Del_Block(0,Cur_Pos)
Search("|H3C/DOC>", NOERR)
if(!EM){
BoL
Del_Block(Cur_Pos, File_Size)
}
Replace("^/+", BEGIN+ALL+REGEXP+NOERR) // remove leading comment characters
BoF
while(! At_EoF){ // shorten lines longer than window width (not perfect, but ...)
Goto_Col(Win_Cols)
Del_Block(Cur_Pos, EoL_Pos)
Line(1, NOERR+ERRBREAK)
}
EoF
#106=Cur_Line - 1 // number of lines to display
#105=Win_Lines - 1 // number of lines displayable in the window
BoF
repeat(ALL){
Win_Clear
Type(#105, NORESTORE)
if(Cur_Line >= #106){
break
}
#104=Get_Key("\nPress any key to continue or to quit ...", STATLINE+RAW)
if(#104==27){
break
}
}
}
Update
Buf_Quit(OK)
Buf_Switch(#103)
Visual_Macro(NOMSG)
if(#104 != 27){
Get_Key("\nPress any key to close help...", STATLINE+RAW)
}
return
//=======================================================================================