Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #4976
| From | "Jamal" <jamal@examples.net> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Indexing with a progress bar |
| Date | 2013-03-27 11:28 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kiv37a$ctg$1@speranza.aioe.org> (permalink) |
| References | <5e5d3496-72c8-4b80-af4f-82122341f5ab@googlegroups.com> |
Hi Philippe,
CreateCDXProg() return value must be a logical value, try setting it to TRUE
not NIL.
HTH,
Jamal
"Philippe Bayard (Belgium)" wrote in message
news:5e5d3496-72c8-4b80-af4f-82122341f5ab@googlegroups.com...
Hi everyone,
I'm trying to do as many people did on this newsgroup : Some index with a
progress bar.
But i can't make it works.
I'm doing this :
METHOD CreateIndex(FileName) CLASS W_INDEXING
LOCAL aIndex := {} as ARRAY
LOCAL pos as DWORD
LOCAL i as DWORD
LOCAL oserver as DbServer
LOCAL lSuccess as LOGIC
LOCAL Max as DWORD
LOCAl oself as OBJECT
LOCAL cFor as STRING
LOCAL lAll, lRest, lDescend as LOGIC
LOCAL cbForCondition, cbWhileCondition, cbEval as USUAL
LOCAL nStep, nStart, nNext, nRecord as SHORTINT
// For condition string format
cFor := null_string
// Actual for condition
cbForCondition := nil
lAll := true
cbWhileCondition := {|| true} // While all
oself := self
cbEval := {||oself:CreateCDXProg()} // Indexing code
// block
nStep := 0 // Step through all
nStart := 0 // From top
nNext := 0 // All
nRecord := 0 // All records
lRest := FALSE // ALL
lDescend := FALSE // Ascending
aIndex := CreateIndexList()
pos := AScan(aIndex,{|aVal| aVal[1] = FileName} )
if pos > 0
oserver:=
DbServer{oEnvObject:cPath+FileName+".dbf",DBEXCLUSIVE}
Max := oserver:Count()
oserver:gotop()
if oserver:used
FOR i:=1 to oserver:OrderInfo(DBOI_ORDERCOUNT)
oserver:DeleteOrder(i,null_string)
NEXT i
self:oDCProgressBar2:Range := Range{ 1
,ALen(aIndex[pos][2]) }
self:Show()
for i:=1 to ALen(aIndex[pos][2])
self:oDCMultiLineEdit1:TextValue += crlf +
"Processing Order "+ AsString(i) + " - " +aIndex[pos][2][i][1]
if i==1
self:oDCProgressBar1:Range :=
Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
lSuccess:= oserver:CreateIndex(
aIndex[pos][1]+".cdx",aIndex[pos][2][i][2])
else
self:oDCProgressBar1:Range :=
Range{ 1, Max }
self:oDCMaxRecord:value := Max
ApplicationExec(1)
//lSuccess:=
oserver:SetOrderCondition(null_string, null_string , , ,
{||oself:CreateCDXProg()},0)
RddSetDefault("DBFCDX")
oserver:SetOrderCondition(cFor,
cbForCondition, lAll,cbWhileCondition, cbEval,nStep, nStart, nNext, nRecord,
lRest, lDescend)
lSuccess:= oserver:createorder(
Lower(aIndex[pos][2][i][1]),oEnvObject:cPath+aIndex[pos][1]+".cdx",Lower(aIndex[pos][2][i][2]))
endif
self:oDCProgressBar2:Advance(1)
next i
else
oserver:close()
return false
endif
oserver:close()
endif
return true
METHOD CreateCDXProg() CLASS W_INDEXING
ApplicationExec(EXECWHILEEVENT) // rgtr 090508
self:oDCProgressBar1:Advance(1)
self:oDCMultiLineEdit1:value += crlf + " Advance 1"
RETURN nil
But the function CreateCDX is only called once a time during the
createOrder, and my code create the order, but don't index the file at all.
My windows says :
Processing Order 1 - CLIENT
Processing Order 2 - CLIENT_NU
Advance 1
Processing Order 3 - CLIENT_TV
Advance 1
Processing Order 4 - CLIENT_NV
Advance 1
Processing Order 5 - CLIENT_MA
Advance 1
If i remove the SetOrderCondition part, everything works pretty well but the
windows freeze during the indexing of big files.
I wanted the CreateCDXProg function to be called each time a record (or
maybe 100 records) is processed to leave the hand to the user and have the
index done!
Any advice would be welcome!
Philippe
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Indexing with a progress bar "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2013-03-27 06:06 -0700
Re: Indexing with a progress bar dlzc <dlzc1@cox.net> - 2013-03-27 07:15 -0700
Re: Indexing with a progress bar "Jamal" <jamal@examples.net> - 2013-03-27 11:28 -0400
Re: Indexing with a progress bar "Philippe Bayard (Belgium)" <philbayard@gmail.com> - 2013-03-27 09:03 -0700
csiph-web