events in msgbox

fiaful

Member
Licensed User
Longtime User
Hello boys and girls ...

Is there a way to process events of B4A from inside a msgbox? Let me explain ...

I wrote a function that allows to create a custom msgbox... it raise an event, before display msgbox, passing a panel object, to define dialog layout and set default values... and raise another event to communicate response... it works as described actually...

So I've create a msgbox with two edittext to input rows and columns numbers of a grid... and it works...

But if I try to select all text into edittext with b4a relative event... any try fails! This is because b4a event queue is paused 'til msgbox disappear... (if I log events I can see)

I've tried with timer, started before msgbox show and stopped after, with DoEvents into Tick event... but is the same (obviously because ALL b4a events are processed after msgbox dismiss, Timer Tick too)...

So... I've tried with thread (both start and run on gui thread) calling DoEvents... this allows focus events of edittext, but crashes the msgbox (and app then)

Idee?

(I can't post the source at moment because I'm in train... I'll do as soon as)

Thanks in advance...
 

agraham

Expert
Licensed User
Longtime User
Is there a way to process events of B4A from inside a msgbox?
If by "custom msgbox" you mean a Custom Dialog from the Dialogs library the answer is no. Only a few events can run while a modal dialog is shown and that is because those events are called directly and not through the message loop. Most events are called from the message loop and so don't run until the modal dialog closes. Threads are of no help because only the main thread can touch the GUI elements and that main thread is stalled by the modal dialog.
 
Upvote 0
Top