DFL background tasks

Scroph via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 7 05:14:01 PDT 2015


Hello,

I couldn't find a DFL subforum so I decided to post here, I 
apologize in advance if this isn't the right place.

I'm currently using DFL to write a Youtube downloading program 
with a simple GUI. I chose DFL because I enjoy the Entice 
Designer WYSIWYG capabilities, but also because I found DFL to be 
easy to use after reading the sample codes, especially the 
Phonebook example. Unfortunately the project is more or less 
abandoned, and the documentation is incomplete.

To make a long story short, there is a ListView that I want to 
populate with information that could take a while to retrieve 
(video qualities and links), which temporarily freezes the 
program. The way I did things thus far was to simply extend the 
Thread class and pass it the UI elements and let it modify them 
directly once the information is retrieved, or by just running 
the task in a delegate that has access to the elements I wish to 
modify, then passing said delegate to an instance of the Thread 
class. It worked with TextBoxes and Buttons and other elements, 
but not with ListView. I did some reading and it turned out this 
was a frowned upon method, that the UI should only be modified by 
the UI thread, and that this could be achieved with the "Invoke" 
method according to some C#-tagged replies on stackoverflow. I 
did some more digging and found an Invoke method in the Control 
class, but its signature is hard for me to decipher. I also am 
not sure how to use this with an onClick event.

Control.invoke documentation : 
http://wiki.dprogramming.com/DflDoc/Control-Control-invoke

Any input is appreciated. Thanks in advance.


More information about the Digitalmars-d-learn mailing list