Great presentation and such an awesome new feature!
Really like your example for logging David, CALL WORKER makes this so easy/fast
without messing with semaphores and such. Huge deal for job queues.
I've been working on some front end stuff and have come up with least 3 really
nice use cases for using CALL WORKER with CALL FORM. All of these examples can
be done without CALL WORKER/FORM, but they seem to make it easier...
1. Async data fetching
If you want async data fetching just like you have with ajax in the web
browser, now it really easy to setup. And if you are fetching data from a 3rd
party it is probably a good idea. For instance, while 4D is running an HTTP
GET, the user interface is locked. If you are getting data from a 3rd party
you can't be sure how long it will take. So you might lock up the interface
for a while as HTTP GET is waiting for a response. That is a bad experience
for the user. Now you can just call a worker to get the data and your UI is
still responsive. When the worker is done it can call the form with the
retrieved data.
- CALL WORKER("HttpGetAsync1";"HttpGetAsync";$Input_o;"CallbackMethod";Current
form window)
- When the worker is done it calls CallbackMethod($Output_o)
2. Lots of async data fetching
What if you want to pull a bunch of stuff from a 3rd party to display in the
UI, how about a bunch of pictures from Amazon S3? Don't just grab one at a
time, do what a web browser would do and fire up 8 workers and make 8 http
requests at a time to pull them faster. Same concept as above but just cycle
through calling workers named HttpGetAsync1, HttpGetAsync2, HttpGetAsync3, etc.
Once you get to 8, cycle back and call HttpGetAsync1 again. What's so great
about CALL WORKER is you don't have to worry about whether HttpGetAsync1 is
already busy making a request, just keep calling it and 4D will handle queuing
all the requests for you.
3. Modal screen example
What if you want a modal screen behind a modal dialog like in this example:
http://www.w3schools.com/bootstrap/bootstrap_modal.asp
Now it is really easy:
MainForm_WinRef_l:=Current form window
DIALOG("MyForm";*) //note the asterisk, learned from Thomas's presentation
OBJECT SET VISIBLE(*;"ModalScreen";True)
Now when you close the dialog just call the window to tell it to hide the
ModalScreen object:
CALL FORM(MainForm_WinRef_l;"HideModalScreen")
Code in HideModalScreen is just:
OBJECT SET VISIBLE(*;"ModalScreen";False)
Fun stuff,
Welsh
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************