persistentConnection

subroutine persistentConnection

***************************************************************************

* Simple persistence

***************************************************************************

* [00] 22Feb01 jdr Initial creation

include wbp w3Include

list      = ""                        ;* data returned to client

err       = w3_OK                     ;* initialize status

names     = "List.col1"               ;* column names are constant

names<-1> = "List2.col1"   

names<-1> = "Text"

   

loop

   prop  = ""                          ;* column properties

   call w3GetVal(text, "Text")         ;* retrieve data from client

   if text # "" then                   ;* add to start of list

      list = insert(list, 1, 1;text)                         

   end                                                      

   cnt = dcount(list<1>, @vm)          

*                                         set properties

   if cnt > 2 then                     ;* last or third to last has focus

      focus = cnt - 2

   end else

      focus = cnt

   end

 

   prop<1, focus>  = p_UCV_FOCUS

   prop<2, focus>  = p_UCV_FOCUS

   prop<2, focus> += p_UCV_SELECTED

 

*                                       every other line is selected

   for i = cnt to 1 step -1

       if mod(i, 2) and i # focus then prop<2,i> = p_UCV_SELECTED

   next i                                                  

                                                           

   call w3mvDInit("", "")

   call w3mvDInsert(names, list:@am:list:@am:"", prop)    

   call w3mvDInput(err, 300, w3_P)

until err # w3_OK do                                      

repeat                                                    

                                                           

return