Category : Files from Magazines
Archive   : VOL10N13.ZIP
Filename : PROMPTYN.PRG
Output of file : PROMPTYN.PRG contained in archive : VOL10N13.ZIP
*
PARAMETERS mess, choice_1, choice_2, top, left, win_title
*
* mess =
* choice_1 =
* choice_2 =
* top =
* left =
* win_title =
**************************
* Local Memory Variables *
**************************
PRIVATE promptvar, ret_val
* Initialize the menu variable
promptvar =1
* What we return to the calling .prg
ret_val = SPACE(5)
**************************************************
* Fill in some parameters if they weren't passed *
**************************************************
IF PARAMETERS() < 1 .OR. EMPTY(mess)
mess = "Please Choose:"
ENDIF
IF PARAMETERS() < 3 .OR. (EMPTY(choice_1) .AND. EMPTY(choice_2))
choice_1 = "Yes"
choice_2 = "No"
ENDIF
* Pad everything with spaces to make it look nicer
choice_1 = " " + choice_1 + " "
choice_2 = " " + choice_2 + " "
*********************************************
* Calculate prompt window size and location *
*********************************************
* Figure out our prompt window width
winwidth = MIN(LEN(mess) + LEN(choice_1) + LEN(choice_2) + 5, ;
SCOLS())
* Now the location, more parameters if necessary
IF PARAMETERS() < 4
top = 99 && Set to 99 if top is not specified
ENDIF
* If top not specified _or_ passed 99
IF top = 99
top = INT((SROWS()/2)-2) && calculate center based on screen rows
ENDIF
bottom = top + 4
* If left not specified _or_ passed 99
IF PARAMETERS() < 5
left = 99 && Set to 99 if left is not specified
ENDIF
IF left = 99
left = INT((SCOLS()-winwidth)/2) && calc center based on screen columns
ENDIF
right = left + winwidth
**********************************
* Define and activate the window *
**********************************
IF PARAMETERS() < 6
DEFINE WINDOW promptwin FROM top,left TO top+4,right PANEL
ELSE
DEFINE WINDOW promptwin FROM top,left TO top+4,right PANEL ;
TITLE " " + win_title + " "
ENDIF
ACTIVATE WINDOW promptwin
*********************************
* Put the choices on the screen *
*********************************
@WROW()-2,1 SAY mess
@ROW(),COL()+1 PROMPT choice_1 MESSAGE " "
@ROW(),COL()+1 PROMPT choice_2 MESSAGE " "
MENU TO promptvar
***************************
* Clean house and go home *
***************************
RELEASE WINDOW promptwin
IF EMPTY(promptvar) && They pressed
ret_val = ""
ELSE
ret_val = IIF(promptvar=1,ALLTRIM(choice_1),ALLTRIM(choice_2))
ENDIF
RETURN ret_val
* eof
FUNCTION promptyn
PARAMETERS mess, choice_1, choice_2, top, left, win_title
*
* mess =
* choice_1 =
* choice_2 =
* top =
* left =
* win_title =
**************************
* Local Memory Variables *
**************************
PRIVATE promptvar, ret_val
* Initialize the menu variable
promptvar =1
* What we return to the calling .prg
ret_val = SPACE(5)
**************************************************
* Fill in some parameters if they weren't passed *
**************************************************
IF PARAMETERS() < 1 .OR. EMPTY(mess)
mess = "Please Choose:"
ENDIF
IF PARAMETERS() < 3 .OR. (EMPTY(choice_1) .AND. EMPTY(choice_2))
choice_1 = "Yes"
choice_2 = "No"
ENDIF
* Pad everything with spaces to make it look nicer
choice_1 = " " + choice_1 + " "
choice_2 = " " + choice_2 + " "
*********************************************
* Calculate prompt window size and location *
*********************************************
* Figure out our prompt window width
winwidth = MIN(LEN(mess) + LEN(choice_1) + LEN(choice_2) + 5, ;
SCOLS())
* Now the location, more parameters if necessary
IF PARAMETERS() < 4
top = 99 && Set to 99 if top is not specified
ENDIF
* If top not specified _or_ passed 99
IF top = 99
top = INT((SROWS()/2)-2) && calculate center based on screen rows
ENDIF
bottom = top + 4
* If left not specified _or_ passed 99
IF PARAMETERS() < 5
left = 99 && Set to 99 if left is not specified
ENDIF
IF left = 99 && calc center based on screen columns
left = INT((SCOLS()-winwidth)/2)
ENDIF
right = left + winwidth
**********************************
* Define and activate the window *
**********************************
IF PARAMETERS() < 6
DEFINE WINDOW promptwin FROM top,left TO top+4,right PANEL
ELSE
DEFINE WINDOW promptwin FROM top,left TO top+4,right PANEL ;
TITLE " " + win_title + " "
ENDIF
ACTIVATE WINDOW promptwin
*********************************
* Put the choices on the screen *
*********************************
@WROW()-2,1 SAY mess
@ROW(),COL()+1 PROMPT choice_1 MESSAGE " "
@ROW(),COL()+1 PROMPT choice_2 MESSAGE " "
MENU TO promptvar
***************************
* Clean house and go home *
***************************
RELEASE WINDOW promptwin
IF EMPTY(promptvar) && They pressed
ret_val = ""
ELSE
ret_val = IIF(promptvar=1,ALLTRIM(choice_1),ALLTRIM(choice_2))
ENDIF
RETURN ret_val
* eof
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/