gadgets slow to appear

BlitzMax Forums/MaxGUI Module/gadgets slow to appear

Boulderdash(Posted 2007) [#1]
Why do some gadgets take two-four seconds to appear after the window sometimes

I am new to GUI and dont know much about it, does this always happen for everybody?

other software using windows API doesnt seem to have that problem or am I wrong? doesn't look good anyway although I can live with it.


WendellM(Posted 2007) [#2]
This may not be connected with your issue, but I came across a similar situation recently. I was creating a small window with just a few labels, textfields, and buttons - nothing fancy - but it took a couple of seconds for the gadgets to appear on the window.

I was using PollEvent and Delay 500 in the main loop (immediately after gadget creation) since it was a low-priority task that needed to update some things periodically whether there were an event or not. Changing the Delay to 50 made the gadgets appear much faster, so it seems to take some CPU activity after gadget creation for them to actually appear.

So, if you're using large Delay values (or, I suppose, doing lots of CPU-intensive stuff right after gadget creation), that might be the issue. If not, then it's something else.

On mid-size projects, I sometimes create all needed windows (with gadgets) hidden at start-up. Then the windows' visibilities can just be toggled with ShowGadget/HideGadget to swap among them quickly rather than having to create/free them and their gadgets repeatedly. [<- heh, I was editing to add this as jsp was posting his suggestion]



jsp(Posted 2007) [#3]
Check if it's the same with debug mode on/off. For me it's quite different.
One thing you could use is creating the window hidden and create all gadgets on top and when ready, just show the window. Thus the gadgets will show up immediately.