View Single Post
  #27 (permalink)  
Old 06-23-2008, 09:14 AM
agraham's Avatar
agraham agraham is offline
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,901
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by TWELVE View Post
- what's wrong here ?
I don't know!
Quote:
Can i call a sub from a sub which has been started as a thread or not ?
Yes, there should be no problem unless you also call that Sub from the main program or another thread. Keep thread code strictly segregated from other code.
Quote:
if it's ok to call a sub from a threaded sub, can the called sub access the controls of the main gui program ?
No. Please read carefully the Thread Pitfalls page of the help. Especially the GUI operations section.
Quote:
if not, how can i work around this ?
Use FireThreadEvent or FireDebugEvent to "call" your subs that manipulate GUI controls. They are provided as a safe path to the the GUI thread. You can only safely manipulate GUI controls in the main thread or in these events or Subs called by them. If you need multiple different operations then distinguish them in the event by setting a Global variable in the thread and doing a Select.... Case in the event.
Reply With Quote