GuiGetEvent() and the EVENT QUEUE

I have a question about the GuiGetEvent() and the EVENT QUEUE described here:
https://www.amibroker.com/guide/h_gui.html

  1. When we call GuiGetEvent( 0, 1 ) to check the code of oldest event in the queue, is this event removed from the queue? From what I understand it is NOT removed from the queue.

  2. When are those events removed from the queue?

For demonstration I created the following example. I call 2 times the GuiGetEvent() with the same parameters, and I get the same results, which means that the event stays in the queue:

MyIdButton = 100;
GuiButton( "enable", MyIdButton, 10,30, 100, 30, notifyClicked|notifyMouseEnter );

whatID=GuiGetEvent( 0, 0 );
whatCODE=GuiGetEvent( 0, 1 );
printf("whatID = "+NumToStr(whatID)+"\n");
printf("whatCODE = "+NumToStr(whatCODE)+"\n");

whatID=GuiGetEvent( 0, 0 );
whatCODE=GuiGetEvent( 0, 1 );
printf("whatID = "+NumToStr(whatID)+"\n");
printf("whatCODE = "+NumToStr(whatCODE)+"\n");

All events are kept in queue as long formula executes and are removed automatically when formula finishes. So you just don't need to do or worry about ANYTHING.

The formula is executed automatically when event occurs and usually you've got only one event (unless your formula is really slooow). Your formula should FINISH as soon as possible without any waiting/pausing.

You have tendency of overthinking stuff. You should rather use "it just works" approach.

For the time being the examples of the documentation do work for me.

I thought to delved deeper and understand what is happening, but no worries for now.