// // PickList.vdm Ch.Ziemski 29.09.2003 // // Provides a picklist of text entries. // // The list is transfered to the macro in T-Reg 103. // // You can choose an entry (=line) via positioning and pressing F12 or // via double-clicking the mouse on that line. // // The resulting(=choosen) line is returned via T-Reg 103 and the line number in #103. // // (It may be not bulletproof yet!) // Num_Push(#90,#95) #106=Buf_Num #107=Win_Num #91=Win_X_Org #92=Win_Y_Org #93=Win_Width #94=Win_Height #95=Win_Lines Buf_Switch(Buf_Free) #105=Buf_Num Reg_Ins(103) #90=Win_Free Win_Split(#90,Min(Cur_Line+2, #95/2),TOP+ATTACH) Win_Title(#90, "Choose a line and press F12 or double-click on that line") BoF Reg_Set(104, "Win_Move(") Num_Str(#107, 104, APPEND+NOCR) Reg_Set(104, ",", APPEND) Num_Str(#91, 104, APPEND+NOCR) Reg_Set(104, ",", APPEND) Num_Str(#92, 104, APPEND+NOCR) Reg_Set(104, ",", APPEND) Num_Str(#93, 104, APPEND+NOCR) Reg_Set(104, ",", APPEND) Num_Str(#94, 104, APPEND+NOCR) Reg_Set(104, ")", APPEND) Reg_Set(116, " if (Buf_Num == #105) { BoL Reg_Copy_Block(103, Cur_Pos, EoL_Pos) #103=Cur_Line Win_Delete() Buf_Quit(OK) Buf_Switch(#106) Win_Switch(#107) Call(104) Reg_Empty(104) Key_Delete('F12', OK) // VM(SET) // DoV('\VE\') Return(0, DELETE) } ") Key_Add("F12", "[VISUAL EXIT] if (Buf_Num == #105) {Call(116)}", OK) Browse_Mode(SET) Num_Pop(#90,#95) Visual()