parameter
pText,pnDBT,pCapt,cPar1,cPar2,cPar3
***_____PROLOG_____***
MemWidth=set('memowidth')
set memowidth to 255
set topic ID to 9999 && your
choice
if empty(pText) .or. NOT type('pText')='C'
pText='MicroSoft Visual
FoxPro' &&your choice; additional to
MessageBox
endif
if empty(pnDBT) .or. NOT type('pnDBT')='N'
if type('pnDBT')='C'
&&if passed only 2 char-parameters; additional to
MessageBox
pCapt=pnDBT
endif
pnDBT=0
endif
if empty(pCapt) .or. NOT type('pCapt')='C'
pCapt='OPTIMA' &&your
choice; additional to MessageBox
endif
***_____DEF Command array_____*** slovenian; your
choice
dimension CmdArr(7)
CmdArr(1)="\<Ok"
&&\<OK
CmdArr(2)="\<Cancelar"
&&\<Cancel
CmdArr(3)="\<Abortar"
&&\<Abort
CmdArr(4)="\<Intentar"
&&\<Retry
CmdArr(5)="\<Ignorar"
&&\<Ignore
CmdArr(6)="\<Si"
&&\<Yes
CmdArr(7)="\<No"
&&\<No
***_____DEF SetFocus &
Pictures_____***
for nSetFocus=3 to 2 step -1
if pnDBT>=256*(nSetFocus-1)
pnDBT=pnDBT-256*(nSetFocus-1)
exit
endif
endfor
for nPict=64 to 0 step -16
if pnDBT>=nPict
pnDBT=pnDBT-nPict
exit
endif
endfor
***_____Wrong DBT_____***
if NOT inlist(pnDBT,0,1,2,3,4,5)
pnDBT=0
pCapt="Error
DialogBoxType"
&&your choice
pText='MicroSoft Visual
FoxPro' &&your choice
nPict=-1
endif
***_____DEF Button Captions array_____***
dimension CaptArr(3)
CaptArr=""
***_____DEF Caption Replacement (optional)
=acopy(CmdArr,CmdArr2)
lPar1=NOT empty(cpar1) .and.
type("cPar1")="C"
lPar2=NOT empty(cpar2) .and.
type("cPar2")="C"
lPar3=NOT empty(cpar3) .and.
type("cPar3")="C"
do case
case pnDBT+1=1
store iif(lPar1,cPar1,CmdArr2(1)) to
CmdArr(1),CaptArr(1) &&OK
CmdGCount=1
case pnDBT+1=2
store iif(lPar1,cPar1,CmdArr2(1)) to
CmdArr(1),CaptArr(1) &&OK
store iif(lPar2,cPar2,CmdArr2(2)) to
CmdArr(2),CaptArr(2) &&Cancel
CmdGCount=2
case pnDBT+1=3
store iif(lPar1,cPar1,CmdArr2(3)) to
CmdArr(3),CaptArr(1) &&Abort
store iif(lPar2,cPar2,CmdArr2(4)) to
CmdArr(4),CaptArr(2) &&Retry
store iif(lPar3,cPar3,CmdArr2(5)) to
CmdArr(5),CaptArr(3) &&Ignore
CmdGCount=3
case pnDBT+1=4
store iif(lPar1,cPar1,CmdArr2(6)) to
CmdArr(6),CaptArr(1) &&Yes
store iif(lPar2,cPar2,CmdArr2(7)) to
CmdArr(7),CaptArr(2) &&No
store iif(lPar3,cPar3,CmdArr2(2)) to
CmdArr(2),CaptArr(3) &&Cancel
CmdGCount=3
case pnDBT+1=5
store iif(lPar1,cPar1,CmdArr2(6)) to
CmdArr(6),CaptArr(1) &&Yes
store iif(lPar2,cPar2,CmdArr2(7)) to
CmdArr(7),CaptArr(2) &&No
CmdGCount=2
case pnDBT+1=6
store iif(lPar1,cPar1,CmdArr2(4)) to
CmdArr(4),CaptArr(1) &&Retry
store iif(lPar2,cPar2,CmdArr2(2)) to
CmdArr(2),CaptArr(2) &&Cancel
CmdGCount=2
endcase
***_____DEF Text_____*** Attention:
Look for default Windows Font!!!
store 0 to nWidth,nRows
cFntName ='Arial'
nFntSize =8
cMaxTxt
=_GetSubText(pText,@nWidth,@nRows,chr(13)) &&&UDF
giving nWidth and nRows
nTxtWidth =nWidth
nTxtRows =nRows
nCaptWidth =TXTWIDTH(pCapt, cFntName,
nFntSize+2)*FONTMETRIC(6,cFntName,nFntSize+2)+10
nTxtHeight =FONTMETRIC(1 , cFntName,
nFntSize)*nTxtRows &&netto Height
nTxtLeft =55
***_____DEF Icons & Wav_____*** All Bells and Picts
your choice
lPictVis=.T.
do case
case nPict=64
set bell to 'ding.wav',0
cPict=_SysIconosXp+'inf_xp.bmp'
&&Information
case nPict=48
set bell to 'chord.wav',0
cPict=_SysIconosXp+'excl_xp.bmp'
&&Exclamation
case nPict=32
set bell to 'chimes.wav',0
cPict=_SysIconosXp+'quest_xp.bmp'
&&Question
case nPict=16
set bell to 'critical.wav',0
cPict=_SysIconosXp+'stop_xp.bmp'
&&Stop
case nPict=0
set bell to 'ding.wav',0
cPict=_SysIconosXp+' '
lPictVis=.F.
nTxtLeft=15 &&Without
Picture
otherwise && only if sent
wrong DBT
set bell to 'CallRing.wav',0
cPict=_SysIconosXp+'appwiz.ico'
endcase
??chr(7)
set bell to
***_____CleanUp_____***
nSetFocus
=min(CmdGCount,nSetFocus)
nButtWidth =75
nButtHeight =26
&&=Default Value
CmdgWidth
=nButtWidth*CmdgCount+6*(CmdGCount-1)
nFormWidth
=nTxtLeft+nTxtWidth+20
MsgFormWidth
=max(nFormWidth,CmdgWidth+20,nCaptWidth+30)
nCmdGTop
=15+nTxtHeight+25
MsgFormHeight=nCmdGTop+nButtHeight+13
***_____MAIN PROGRAM_____***
RetValue=0
FrmMsgBox = CREATEOBJECT('MsgBox')
keyboard replicate('{TAB}',nSetFocus-1)
*FrmMsgBox.Butt(nSetFocus).SetFocus
&&ValidEvent in calling procedure generates Error
FrmMsgBox.Show(1)
***_____EPILOGUE__________***
set memowidth to MemWidth
return
RetValue
***_____CLASSES_____*
DEFINE CLASS skinvfp AS olecontrol
Height = 35
Width = 37
*-- Ubicación del skin para el
formulario
fileskin =
"C:\Sys_Dental\skinvfp\jade2.skn"
Name = "skinvfp"
PROCEDURE Init
WITH this
.loadSkin(.fileskin)
.applySkin(thisform.HWnd)
ENDWITH
ENDPROC
ENDDEFINE
DEFINE CLASS MsgBox AS FORM
DIMENSION Butt[3]
ScaleMode = 3
&&Pixels
ShowWindow = 1 &&In Top-Level
Form
BorderStyle= 2 &&Fixed
Dialog
Closable = .F.
ControlBox = .F.