New topic: 

Inheriting from Thread.

<http://forums.realsoftware.com/viewtopic.php?t=47821>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        BrianOBrien          Post subject: Inheriting from 
Thread.Posted: Wed May 08, 2013 11:49 am                                 
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                When I 
derive a class,myClass, from Thread, why is it that the Run method isn't 
implemented by the user of the myClass::Run?
Like why is it that each instance of myClass has to have the same 
implementation of Run?
If I do implement the Run method in the derived class then the events that the 
class defines gives
Error: This item does not Exist....  And some other error message like you 
can't create an event on a window because there would be no one to implement it?
     
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top                timhare          Post subject: 
Re: Inheriting from Thread.Posted: Wed May 08, 2013 11:56 am                    
     
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12299
Location: Portland, OR  USA                You must Add Event Definition and 
"pass the event forward" if you put code in the Run event of your subclass.  
Eg.,

myClass.Run
// do some setup stuff
..

// Now call the subclass Run event
RaiseEvent Run

// do some cleanup stuff
..   
                             Top                BrianOBrien          Post 
subject: Re: Inheriting from Thread.Posted: Wed May 08, 2013 2:42 pm            
                     
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                Ok so in 
the myClass I add an event named Run.
In the Run method of myClass I call RaiseEvent Run
In the users Run Event I put my long loop.  However in this method I can not 
RaiseEvents or call my implemented events of MyClass Instance..      
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top                Jason_Adams          Post 
subject: Re: Inheriting from Thread.Posted: Wed May 08, 2013 2:45 pm            
                     
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1820
Location: Michigan, USA                True... Is that not what you want? Why 
not just put the long loop code in the Thread.Run event? I'm having a hard time 
understanding what you're trying to do.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                BrianOBrien          Post 
subject: Re: Inheriting from Thread.Posted: Wed May 08, 2013 2:52 pm            
                     
Joined: Wed Jul 07, 2010 2:55 pm
Posts: 703
Location: University Of Calgary, Faculty Of Medicine                I have two 
types of databases MySQL and PostGres.
I am doing an SQL Select on each of the databases.  This SQL Select statement 
can take about a half hour to complete.
So I put the Select in the Run Method of MyClass::Thread.Run.  
However the SQLSelect requires a database connection to run off of.
and that can't have two different connection types...
So I created two different Instances of MyClass then the each instance can put 
the SQLSelect in their run event method.
However that brings me full circle to where I am currently stuck.      
_________________
If at first you don't succeed... Try REALBasic and if that doesn't work try 
Xojo.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to