' 'Class description: ' !short:Task class structure: Class Task: ~~~~~~~~~~~~ This class is base for all objects, which seem to be indenpendent runing tasks. The complete task switching is enabled with object manipulation. The special menu for active window control is offered. The tasks can be switched, the window assigned to each task is movable, sizeable and can be iconised. Common use: ~~~~~~~~~~~ If you dislike standard class View for input/output manipulation, you can as superset to class Task create your own class. If you use a screen generator (with this library it needn't), you can reach the output source code of this generator to behave as class View. To do so you must: 1.Create your own class derived from task class. 2.Define own virtual methds Init(), VPaint(), Vprocess(). The method Init should set the window size range. The method Vpaint should paint the window contet and end itself. Vprocess() is the basic function to do when the window becomes active. It should return control when becoming key value nSwapTask(255). Or you can simply use class ^UMask^N. Source code is in C_Task.prg !seealso: c_window.ngo:Window c_browse.ngo:Browse c_frame.ngo:Frame c_menu.ngo:Menu c_color.ngo:Color ob_class.ngo:"Class hierarchy" !short:~~~~~~~~~~~~~~~~~~~~~ !short:create class Task from Window !short: export: !short: var IsDead //false ^BTask:IsDead^N: read-only: logical If true, the object was succesfully destroyed. The further object manipulation is only allowed to obtain information from its instvar variables. !short: var DoneBlock //{||true} ^BTask:DoneBlock^N: public: code_block Here can be code block placed to do the window closing connected job. (i.g. saving of changed text). If it returns true the object (class) can be destroyed, if false it can't be destroyed and the control is passed to virtual process of this task from the task swapper. When calling the code block Task:DoneBlock is the object of instvar variable Doneblock passed as a parameter. !short: method New=TaskNew //o:New() --> self ^BTask:New()^N: public: return self Object is filled with default values. !short: method Init=TaskInit //o:Init(Name,R,C,Rs,Cs,Clr,Shd) --> true ^BTask:Init(Name,R,C,Rs,Cs,Clr,Shadow)^N: return true Preparing job is done here by initialising the window, adding the new task to the stack (for the task swapper), the hot keys are set. The new task window remains unvisible after finishing of Task:Init. Parameter description: ~~~~~~~~~~~~~~~~~~~~~~ ^UName^N: text alebo kodovy blok: default is {||""}, i.e. no title. Text or code block as window title. ^UR^N: numeric: default is 3. Upper window border. ^UC^N: numeric: default is 4. Left window border. ^URs^N: numeric: default is MaxRow()-7. Window height in number of rows passed into. ^UCs^N: numeric: default is MaxCol()-9. Window widthin number of columns passed into. ^UClr^N: character: default is m->Color:Edit. Window color. ^UShadow^N: logical: default is true for color monitor, false for monochrom. If true, the shadow will be painted. !short: method GoodInit=TaskGoodInit //o:GoodInit(Name,R,C,Rs,Cs,CurSize,Clr,Shd) --> true ^BTask:GoodInit(Name,R,C,Rs,Cs,CurSize,Clr,Shadow)^N: public: return true Preparing job is done here by initialising the window, adding the new task to the stack (for the task swapper), the hot keys are set. The new task window remains unvisible after finishing of Task:Init. The position of the new window is counted by herited method GoodInit() of class Box to be nearest possible to the cursor and not to cover any required text. The window should be visible whole. Parameter description: ~~~~~~~~~~~~~~~~~~~~~~ ^UName^N: text or code block: default is {||""}, i.e. no title Text or code block as window title. ^UR^N: numeric: default is Row(). The row text position the window to be put nearest possible. ^UC^N: numeric: default is Col(). The column text position the window to be put nearest possible. ^URs^N: numeric: default is MaxRow()-7. Required window height in number of rows passed into. ^UCs^N: numeric: default is MaxCol()-9. Required window width in number of columns passed into. ^UCurSize^N: numeric: default is 1. Text size that should not be covered but the window should be nearest possible. ^UClr^N: character: default is m->Color:Edit. Window colors. ^UShadow^N: logical: default is true for color monitor, false for monochrom. If true,the shadow will be painted. !short: method Top=TaskTop //o:Top(lRepaint) --> true ^BTask:Top(lRepaint)^N: public: return true The task is set as active, switched to front and painted in active task colors. Parameter description ~~~~~~~~~~~~~~~~~~~~~ ^UlRePaint^N: logical: default is true If lRepaint is true, the screen is erased and all windows are repainted from the stack of windows. !short: method VProcess=TaskVProcess //o:VProcess() --> new_active_task_objekt ^BTask:VProcess()^N: public: return new_active_task_objekt This virtual method is for active part of the task. In this class it only waits for key pressing and the ends. It should be redefined by derived classes for doing required job. The return value can be another object derived from the task class and it becomes active. This enables the task chaining, to estabilish conections between the objects (which enables multi-threading). See the instvar variable DoneBlock. This method must be finished when receiving the nSwapTask code (255) from the keyboard and must be resartable. For task finishing is used method Done(). !short: method Process=TaskProcess //o:Process() --> true ^BTask:Process()^N: public: return true It is aplication loop which is finished only when the main program menu is active. The task switching is controled by task-swapper. For each window, which becomes active is the virtual method VProcess() activated. The creation of virtual method Process has the sense only for post initialisation of objects of user defined class. It is sufficient to run VPaint() (window content painting) and VProcess() (the task work). !short: method Done=TaskDone //o:Done(lRePaint) --> true/false ^BTask:Done(lRePaint)^N: return true/false The object (task) finishing, only when code block DoneBlock returns true. It is not usual to use this method due to user requested task finishing by pressing ESC or Ctrl-Enter when the task is active. Then is the task finishing activated from Task:Process() method. This method is for task finishing by own program code part. !short: endclass