Hello,
I have a MessageRequester in a loop, and I'd like to display a warning message in the requester that don't stop the loop when waiting for user validation.
Is there a way to proceed without using a separate thread for the MessageRequester ?
Thanks for your help !
Regards.
Non-blocking MessageRequester ?
This works nicely, but does use threads....
And then this works in Windows to allow access to the main window, rather than wait for all the message boxes to be closed:
Why no threads?
Code: Select all
Structure msgstruc
title$
message$
EndStructure
Procedure MessageBoxT(*para.msgstruc)
MessageRequester(*para\title$, *para\message$)
FreeMemory(*para)
EndProcedure
Procedure MessageBox(title$, message$)
*tempstruc.msgstruc = AllocateMemory(SizeOf(msgstruc))
*tempstruc\title$ = title$
*tempstruc\message$ = message$
CreateThread(@MessageBoxT(),*tempstruc)
EndProcedure
For a=1 To 3
MessageBox("test","message!")
Next a
Delay(5000)
Code: Select all
Structure msgstruc
title$
message$
EndStructure
Procedure MessageBoxT(*para.msgstruc)
;MessageRequester(*para\title$, *para\message$)
MessageBox_(0, *para\title$, *para\message$, 0)
FreeMemory(*para)
EndProcedure
Procedure MessageBox(title$, message$)
*tempstruc.msgstruc = AllocateMemory(SizeOf(msgstruc))
*tempstruc\title$ = title$
*tempstruc\message$ = message$
CreateThread(@MessageBoxT(),*tempstruc)
EndProcedure
For a=1 To 3
MessageBox("test","message!")
Next a
OpenWindow(0, 0, 0, 100,100,"msgbox test")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
End
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
MsgBox is definitely designed to block the calling thread,
because you should be able to change something before the processing continues.
dropping messages while processing normally is put into some listing gadget,
like the compiler messages downleft in the IDE.
sure it's more work, but you should program something own that is obviously different from a messagerequester...
else your customers may ask "wutufu? why does the bloody prog not stop while requester?"
because you should be able to change something before the processing continues.
dropping messages while processing normally is put into some listing gadget,
like the compiler messages downleft in the IDE.
sure it's more work, but you should program something own that is obviously different from a messagerequester...
else your customers may ask "wutufu? why does the bloody prog not stop while requester?"
oh... and have a nice day.
Re: Non-blocking MessageRequester ?
There's a post here (do a search) for a timed messagebox that times out
after X seconds... maybe that's what you want?
after X seconds... maybe that's what you want?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
First of all, I'd like to thank eveybody for your help...
I was wondering if there was a "hidden" parameter for the MessageRequester allowing to do what I need. I'm #1 at reinventing the wheel coding 100's of buggy lines whereas the needed function already exists !
I had a look at MSDN's website before botehring you, but I didn't found what I was looking for. You're definitely right : This function just works as it should !
Thanks again for your help, I really appreciate. I will use Matt's code to implement my requester !
Regards.
I was wondering if there was a "hidden" parameter for the MessageRequester allowing to do what I need. I'm #1 at reinventing the wheel coding 100's of buggy lines whereas the needed function already exists !
I had a look at MSDN's website before botehring you, but I didn't found what I was looking for. You're definitely right : This function just works as it should !
Thanks again for your help, I really appreciate. I will use Matt's code to implement my requester !
Regards.
Yep, I looked through the documentation as well before writing that code... as I was not able to find anything eitherFirst of all, I'd like to thank eveybody for your help...
I was wondering if there was a "hidden" parameter for the MessageRequester allowing to do what I need. I'm #1 at reinventing the wheel coding 100's of buggy lines whereas the needed function already exists !
I had a look at MSDN's website before botehring you, but I didn't found what I was looking for. You're definitely right : This function just works as it should !

delta69 wrote: Thanks again for your help, I really appreciate. I will use Matt's code to implement my requester !
