Sometimes we think: the guy wants everything for free ... but please this is not the case.
I made my way to the one and tried to run this function MyMsgWait and am available to you:
Code: Select all
Function MyMsgWait(cMessage, cTitle, nTime)
Local I:=0, nHeight:=0, nLastLine:=0
Private lLoop := .T.
cMessage:=If(cMessage=Nil," ",cMessage)
cTitle:=If(cTitle=Nil,"Atenção",cTitle)
nTime:=If(nTime=Nil, 10 , nTime)
If IsWindowDefined(Upper("Form'"))
ThisWindow.Release()
Endif
nHeight:=((If((HMG_Len(cMessage)/68)-Int(HMG_Len(cMessage)/68)=0,Int(HMG_Len(cMessage)/68),Int(HMG_Len(cMessage)/68)+1))*40)+30
If nHeight <= 70
nHeight := 90
Endif
DEFINE WINDOW FormMsgWait AT 0,0 WIDTH 300 HEIGHT nHeight+35 ;
TITLE cTitle ICON 'info.bmp' MODAL NOSIZE ;
ON RELEASE If(lLoop,lLoop:=.F.,) ON INIT Counting(nTime)
ON KEY ESCAPE of FormMsgWait ACTION FormMsgWait.Release
For I:=1 TO MLCount(cMessage,68,8,.f.)
cTexLabel := 'Text'+Str(I,1)
nLastLine := nLastLine+20
@ nLastLine,06 LABEL &cTexLabel WIDTH 278 HEIGHT 16 ;
VALUE HMG_PADC(Alltrim(MemoLine(cMessage,68,I,8,.t.)),68) ;
FONT 'ARIAL' SIZE 10 CENTERALIGN
Next I
@ nLastLine+30,115 BUTTON Button_1 CAPTION '&Ok' ;
WIDTH 80 HEIGHT 30 ACTION (FormMsgWait.Release)
END WINDOW
CENTER WINDOW FormMsgWait
ACTIVATE WINDOW FormMsgWait
Return Nil
Function Counting(nSecs)
Local nSeconds := 0, nCount := nSecs
Do While nCount > -1 .and. lLoop
If Abs( Seconds() - nSeconds ) >= 1
FormMsgWait.Button_1.Caption:=LTrim(Str(nCount))+" Second"+If(nCount > 1, "s", "")
nSeconds := Seconds()
nCount--
Endif
Do Events
Enddo
If lLoop
lLoop := .F.
FormMsgWait.Release()
Endif
Return Nil
But it did not work where I wanted it to work (before activation of the Main window).
![Screen.PNG](./download/file.php?id=3349&sid=98ab4f961995c2be561d7963dd7609fa)
- Screen.PNG (12.45 KiB) Viewed 6456 times
This happend because this:
![Screen2.PNG](./download/file.php?id=3350&sid=98ab4f961995c2be561d7963dd7609fa)
- Screen2.PNG (17.67 KiB) Viewed 6456 times
As we know, the MessageBox function C does not depend on it, and for this reason I come to ask (perhaps the person who always contributed his expertise in C) the creation of a new function that allows do the autorelease through some timer. But it must be done in C.
This function I'm wanting is to be used in
this example and also will be usefull for other cases as well.
I do not know if I'm the only one in need of it ...
![Sad :(](./images/smilies/icon_e_sad.gif)