Class HISTORY

Name

HISTORY  --  Class are destined to control listing of history.

Synopsis

 HistoryObj(nLrow, nLcol, nRrow, nRcol, sColor) --> QUEUE object

Description

Class are destined to control listing of history.

Attributes

<ClassName> HISTORY
<Lrow> Numeric, a HISTORY viewport coordinates
<Lcol> Numeric, a HISTORY viewport coordinates
<Rrow> Numeric, a HISTORY viewport coordinates
<Rcol> Numeric, a HISTORY viewport coordinates
<History> Array, array of history items
<Header> String, the history box header
<Size> Numeric, the max size history array
<ColorSpec> String, color specification.
  "clr1, clr2, clr3, clr4"
  clr1 - border and items color
  clr2 - current item colors if object in focus
  clr3 - current item colors if object outof focus
  clr4 - title colors

Methods

ADD Add item into history.
DELETE Delete item from history.
FIRST Get first item.
HISTORYOBJ HISTORY object constructor.
INSERTTOFIRST Insert item to first position.
RUN Run history.
SET Init history.
SETSIZE Set new size history array.

Method HISTORY:ADD()

 Add(<sData>) --> NIL

Add() is addes data <sData> to the end of history array <::History>.

If <sData> already exist within <::History>, it removes from old place and addes to the end of <::History>.

Method HISTORY:DELETE()

 Delete(<sData>) --> TRUE || FALSE

Delete() is deletes data <sData> from the history array <::History>. The size of <::History> not changes.

If <sData> exist into <::History>, it removes, all lower items shift up one position and Delete() returns TRUE.

Method HISTORY:FIRST()

 First() --> <sData>

First() returns first item of history array <::History> as string <sData> without removes element from array.

Method HISTORY:HISTORYOBJ()

 HistoryObj(nLrow, nLcol, nRrow, nRcol, sColor) --> QUEUE object

HistoryObj() is constructs and returns new HISTORY object. That class can be use to manipulating listing of history( for example, history listing of loaded files)

Method HISTORY:INSERTTOFIRST()

 InsertToFirst(<sData>) --> NIL

InsertToFirst() is inserts data <sData> to history array <::History> begin with first position. All items with one will be shifted down one position.

If <sData> already exist within <::History>, it removes from old place and insert to first position.

Method HISTORY:RUN()

 Run([<nPos>][, <lItem>]) --> <vData>

Run() is drows history and it is simple key handler and returns by press <ENTER> value or index of selected item.

Method HISTORY:SET()

 Set(<aArr>[, <nSize>]) --> NIL

Set() truncates <::History> to zero and addes to <::History> items from <aArr>.

New size of history buffer is <nSize>. If <nSize> not specified, then new size is size of <aArr>

Method HISTORY:SETSIZE()

 SetSize(<nSize>) -->

SetSize() set new size <nSize> for history array <::History>.

Example:

  History := HistoryObj(5, 5, 10, 30)
 do while .t.
 fname := fileDialog()
 if !empty(fname)
 History:InsertToFirst(fname)
 else
 exit
 endif
 enddo
 
 do while .t.
 fname := History:Run()
 str := memoread(fname)
 memoedit(str, 0, 0, maxrow(), maxcol())
 enddo
 

Platforms

No dependies of platform.