free vision questions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

free vision questions

Tony Pelton
hi all,

having a great time playing with free vision right now.

a quick question ...

can i get a hooked into the event loop thread for doing work ?

said a different way ...

based on my experience with other event driven GUI paradigms ... i'm
assuming ...

in the background, there is a thread of execution that is polling for
events in the ui, keyboard and mouse and dispatching those events into
the event loop  ?

i then trap those events in my code and "do stuff".

standard event driven gui stuff.

i would love to be able to "poll" some of my own code from the
existing event thread, checking for network data, and then dispatch
events into event queue that i can then handle inside the event loop,
to update widgets with the data.

is this a reasonable line of thinking for FV ?

am i overthinking this ? in other ui subsystems i've worked with (GUI
rather than console) it has always been imperative to be careful how
you deal with widgets when you aren't the event/refresh thread.

bottom line, if possible, i would like to avoid spinning my own thread
to do network polling, and once i see some data on the wire, i want to
be able to *safely* process that data and dispatch it into widgets in
realtime.

i'm still trying to understand widgets and their relationship to
"backing" record types and pointers to data as well.

not sure if i'm suppossed to initialize widgets with their backing
data structures once, and then use handles to those structures to just
change the data and the widget will refresh and show the data.

anyway ... i might be digressing.

mostly, i'm just trying to understand if i can hook my own code into
the event loop thread and take advantage of the thread to do polling
of my own.

tia,
Tony
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: free vision questions

Tomas Hajny
Tony Pelton wrote:

> hi all,
>
> having a great time playing with free vision right now.
>
> a quick question ...
>
> can i get a hooked into the event loop thread for doing work ?
>
> said a different way ...
>
> based on my experience with other event driven GUI paradigms ... i'm
> assuming ...
>
> in the background, there is a thread of execution that is polling for
> events in the ui, keyboard and mouse and dispatching those events into
> the event loop  ?
>
> i then trap those events in my code and "do stuff".
>
> standard event driven gui stuff.
>
> i would love to be able to "poll" some of my own code from the
> existing event thread, checking for network data, and then dispatch
> events into event queue that i can then handle inside the event loop,
> to update widgets with the data.

One possibility probably is to override the GetEvent method to add
additional events (and then you handle them in your HandleEvent method
accordingly). Everything you call in GetEvent must be non-blocking.


 .
 .
> bottom line, if possible, i would like to avoid spinning my own thread
> to do network polling, and once i see some data on the wire, i want to
> be able to *safely* process that data and dispatch it into widgets in
> realtime.
 .
 .

Well, spinning another thread which would poll the network all the time
and just issue PutEvent call afterwards might be possible in theory, but
I'm afraid that FV code has never been updated to be thread-safe (i.e.
additional effort would be required here first).

Tomas

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal