For Programmers: Free Programming Magazines  


Home > Archive > Clarion > July 2006 > dreaming....









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author dreaming....
IGM-Man

2006-07-26, 6:55 pm

I'm new to OOP and had worked out a plan for a process I needed. My
goal was to have a CLASS that I could use as the basis for many
processes I need. The kicker is that I need the class to be able to run
in a new thread. Apparently, you can not init a new thread to a method
in a class or have a class start a thread by calling one of it's procs.

I've pretty much come to the conclusion that this ain't going to work
but still hold a glimmer of hope.

Here is a very generic outline:

MyClass CLASS,TYPE

Init PROC
StartWorking PROC(STRING parms)
GetTheStatus PROC
Die PROC
END

I want to be able to start *multiple instances* of MyClass running over
in the corner by themselves and allow my main app to continue and check
on them from time to time.

Robert Peros

2006-07-27, 3:55 am

"IGM-Man" <ken.moyer@doodysicr.com> wrote in message
> I'm new to OOP and had worked out a plan for a process I needed. My
> goal was to have a CLASS that I could use as the basis for many
> processes I need. The kicker is that I need the class to be able to run
> in a new thread. Apparently, you can not init a new thread to a method
> in a class or have a class start a thread by calling one of it's procs.
> I've pretty much come to the conclusion that this ain't going to work
> but still hold a glimmer of hope.<cut>

You can't do that in/from class,but w/o problems inside MAP-ed proc.So
Inside x.clw
MEMBER()
MAP
StartedThread(STRING Addr)
END

> MyClass CLASS,TYPE
> StartWorking PROC(STRING parms)


x_MyClass.StartWorking PROC(STRING Addr/Params with included address)
CODE
IF SELF.Thread = 0 /whatever
SELF.Thread = START(StartedThread,25000,ADDRESS(SELF))

END !^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

StartedThread PROCEDURE(STRING Addr)
x &x_MyClass !Caller Class
Window WINDOW....
CODE
x &= (Addr)
OPEN(x.Win_Ref/Window/LocalWindow) !, x.OwnerWin)
ACCCEPT
...
END

R.



IGM-Man

2006-07-27, 7:55 am

very slick , thank you

Robert Peros wrote:
> "IGM-Man" <ken.moyer@doodysicr.com> wrote in message
> You can't do that in/from class,but w/o problems inside MAP-ed proc.So
> Inside x.clw
> MEMBER()
> MAP
> StartedThread(STRING Addr)
> END
>
>
> x_MyClass.StartWorking PROC(STRING Addr/Params with included address)
> CODE
> IF SELF.Thread = 0 /whatever
> SELF.Thread = START(StartedThread,25000,ADDRESS(SELF))

> END !^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
>
> StartedThread PROCEDURE(STRING Addr)
> x &x_MyClass !Caller Class
> Window WINDOW....
> CODE
> x &= (Addr)
> OPEN(x.Win_Ref/Window/LocalWindow) !, x.OwnerWin)
> ACCCEPT
> ...
> END
>
> R.


Robert Peros

2006-07-28, 3:55 am

"IGM-Man" <ken.moyer@doodysicr.com> wrote in message
> very slick , thank you

Not problem,more info you can find in Popup.clw->
PopupClass.Toolbox(..) class and map PopToolbox procedure.

Similar tehnic can/must be used for Cw{PROP:LibHook,xx} or
sub-classing win->CallWindowProc,etc.

R




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com