Re: Fluid Application Environment 3.0.alpha1 Released!

new topic     » goto parent     » topic index » view thread      » older message » newer message

I forgot to mention something in the Manual.

In fluidae.e there is a procedure:

export procedure call_task(integer rid, sequence args) 
    void = task_create(routine_id("temp_task"), {rid, args}) 
    task_schedule(void, {0.001, 0.1}) 
end procedure 

It makes it super easy to start a separate task. For example, say you want a splash screen to appear for a few seconds as the program is starting. First, create the main window, then start the splash screen task, then continue loading things into the main window.

 
procedure start() 
    gui:start(routine_id("gui_event")) 
     
    gui:wcreate({ 
        {"name", "winMain"}, 
        {"class", "window"}, 
        {"title", "FluidAE Demo Application"}, 
        {"size", {640, 480}} 
    }) 
     
    call_task(routine_id("show_splash"), {}) 
    ... 

In the show_splash() routine, you create a window that displays an image, task_delay() for a few seconds, then destroy that window. This happens while the start() procedure continues to run.

FluidAE can do much more with multitasking than that. For example, you could write a procedure that creates a dialog with a progress bar and a cancel button and then starts processing a large file (call task_yield() often, of course). While it is processing the file, it can update the progress bar. You could start multiple instances of this procedure, all while the rest of your application is still able to respond to events from any widget. It doesn't matter what tasks are running, all the event handlers still work, and any task can make changes to the GUI, as long as every task is calling task_yield() frequently so that the GUI's tasks can keep processing things. I will write an application that demonstrates this.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu