mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-28 11:17:46 +00:00
Replaces ideyesnobox$ with call to idemessagebox.
This commit is contained in:
parent
5ac2f6291c
commit
818fc95181
1 changed files with 2 additions and 116 deletions
|
@ -11897,122 +11897,8 @@ END FUNCTION
|
|||
|
||||
|
||||
FUNCTION ideyesnobox$ (titlestr$, messagestr$) 'returns "Y" or "N"
|
||||
'-------- generic dialog box header --------
|
||||
PCOPY 3, 0
|
||||
PCOPY 0, 2
|
||||
PCOPY 0, 1
|
||||
SCREEN , , 1, 0
|
||||
focus = 1
|
||||
DIM p AS idedbptype
|
||||
DIM o(1 TO 100) AS idedbotype
|
||||
DIM sep AS STRING * 1
|
||||
sep = CHR$(0)
|
||||
'-------- end of generic dialog box header --------
|
||||
|
||||
'-------- init --------
|
||||
i = 0
|
||||
w = LEN(messagestr$) + 2
|
||||
w2 = LEN(titlestr$) + 4
|
||||
IF w < w2 THEN w = w2
|
||||
idepar p, w, 4, titlestr$
|
||||
|
||||
i = i + 1
|
||||
o(i).typ = 3
|
||||
o(i).y = 4
|
||||
o(i).txt = idenewtxt("#Yes" + sep + "#No")
|
||||
o(i).dft = 1
|
||||
'-------- end of init --------
|
||||
|
||||
'-------- generic init --------
|
||||
FOR i = 1 TO 100: o(i).par = p: NEXT 'set parent info of objects
|
||||
'-------- end of generic init --------
|
||||
|
||||
DO 'main loop
|
||||
|
||||
'-------- generic display dialog box & objects --------
|
||||
idedrawpar p
|
||||
f = 1: cx = 0: cy = 0
|
||||
FOR i = 1 TO 100
|
||||
IF o(i).typ THEN
|
||||
'prepare object
|
||||
o(i).foc = focus - f 'focus offset
|
||||
o(i).cx = 0: o(i).cy = 0
|
||||
idedrawobj o(i), f 'display object
|
||||
IF o(i).cx THEN cx = o(i).cx: cy = o(i).cy
|
||||
END IF
|
||||
NEXT i
|
||||
lastfocus = f - 1
|
||||
'-------- end of generic display dialog box & objects --------
|
||||
|
||||
'-------- custom display changes --------
|
||||
COLOR 0, 7: LOCATE p.y + 2, p.x + 2: PRINT messagestr$;
|
||||
'-------- end of custom display changes --------
|
||||
|
||||
'update visual page and cursor position
|
||||
PCOPY 1, 0
|
||||
|
||||
IF cx THEN SCREEN , , 0, 0: LOCATE cy, cx, 1: SCREEN , , 1, 0
|
||||
|
||||
'-------- read input --------
|
||||
change = 0
|
||||
DO
|
||||
GetInput
|
||||
IF mWHEEL THEN change = 1
|
||||
IF KB THEN change = 1
|
||||
IF mCLICK THEN mousedown = 1: change = 1
|
||||
IF mRELEASE THEN mouseup = 1: change = 1
|
||||
IF mB THEN change = 1
|
||||
alt = KALT: IF alt <> oldalt THEN change = 1
|
||||
oldalt = alt
|
||||
_LIMIT 100
|
||||
LOOP UNTIL change
|
||||
IF alt AND NOT KCTRL THEN idehl = 1 ELSE idehl = 0
|
||||
'convert "alt+letter" scancode to letter's ASCII character
|
||||
altletter$ = ""
|
||||
IF alt AND NOT KCTRL THEN
|
||||
IF LEN(K$) = 1 THEN
|
||||
k = ASC(UCASE$(K$))
|
||||
IF k >= 65 AND k <= 90 THEN altletter$ = CHR$(k)
|
||||
END IF
|
||||
END IF
|
||||
SCREEN , , 0, 0: LOCATE , , 0: SCREEN , , 1, 0
|
||||
'-------- end of read input --------
|
||||
|
||||
IF UCASE$(K$) = "Y" THEN altletter$ = "Y"
|
||||
IF UCASE$(K$) = "N" THEN altletter$ = "N"
|
||||
|
||||
'-------- generic input response --------
|
||||
info = 0
|
||||
IF K$ = "" THEN K$ = CHR$(255)
|
||||
IF KSHIFT = 0 AND K$ = CHR$(9) THEN focus = focus + 1
|
||||
IF (KSHIFT AND K$ = CHR$(9)) OR (INSTR(_OS$, "MAC") AND K$ = CHR$(25)) THEN focus = focus - 1: K$ = ""
|
||||
IF focus < 1 THEN focus = lastfocus
|
||||
IF focus > lastfocus THEN focus = 1
|
||||
f = 1
|
||||
FOR i = 1 TO 100
|
||||
t = o(i).typ
|
||||
IF t THEN
|
||||
focusoffset = focus - f
|
||||
ideobjupdate o(i), focus, f, focusoffset, K$, altletter$, mB, mousedown, mouseup, mX, mY, info, mWHEEL
|
||||
END IF
|
||||
NEXT
|
||||
'-------- end of generic input response --------
|
||||
|
||||
IF K$ = CHR$(27) THEN
|
||||
ideyesnobox$ = "N"
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
|
||||
IF info THEN
|
||||
IF info = 1 THEN ideyesnobox$ = "Y" ELSE ideyesnobox$ = "N"
|
||||
EXIT FUNCTION
|
||||
END IF
|
||||
|
||||
'end of custom controls
|
||||
mousedown = 0
|
||||
mouseup = 0
|
||||
LOOP
|
||||
|
||||
result = idemessagebox(titlestr$, messagestr$, "#Yes;#No")
|
||||
IF result = 1 THEN ideyesnobox$ = "Y" ELSE ideyesnobox$ = "N"
|
||||
END FUNCTION 'yes/no box
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue