// // di1-scroll.vdm Christian Ziemski 21.08.2003 // // if (OS_Type != 1) { Statline_Message("Sorry, this macro requires VEDIT for Windows.") return } Num_Push(103,106) // save used registers Reg_Push(103,106) // ----- user configurable section ------------------------------------------- #104=4 // number of lines to display on each "page" Reg_Set(103, "Info - Demo for DI1-SCROLL.VDM") // Title Reg_Set(104,^This macro generates a dialog window with free text. You can page forward/backward through this text. The text is given via T-Reg 104 to this macro and #104 defines the number of lines to display at once. T-Reg 103 contains the title to be displayed in the dialog. This way you can implement an advanced popup (e.g. for help infos or the like.) ^) // ---------------------------------------------------------------------------- Buf_Switch(Buf_Free(EXTRA)) Reg_Ins(104) // For security; to prevent DI1() from beeing killed - but not foolproof! Replace("`","'", BEGIN+ALL+NOERR) Replace("||","!", BEGIN+ALL+NOERR) // find longest line #103=0 BoF while (! At_EoF) { EoL if (Cur_Col > #103) { #103=Cur_Col } Line(1, NOERR) } // Create a line of underscores of (hopefully) appropriate length // to size the dialog's width. // (Due to the used proportional font it's only guessing!) BoF Ins_Char(95, COUNT, Max(37,#103)) Ins_Newline(1) BoF Reg_Copy(106, 1) Del_Line(1) // scroll through the text Reg_Set(104, "&Next") // button label while (! At_EoF) { Reg_Copy(105,#104) #105=Cur_Line Line(#104, NOERR) if (At_EoF) { // change the button label if at EoF Reg_Set(104, "E&nd") } #105=Cur_Line - #105 // remember the number of lines gone forward #103=Dialog_Input_1(103,^`|@(103)`, `|@(105)`, `|@(106)`, `[|@(104)]`,`[&Previous]`,`[&Cancel]`^,SET+APP+CENTER,0,0) if (#103 == 2) { // [Previous] Reg_Set(104, "&Next") Line(-#104-#105, NOERR) continue } if (#103 != 1) { // not [Next] break } } Buf_Quit(OK) Reg_Pop(103,106) // restore used registers Num_Pop(103,106)