steveauckly
23rd March 2011, 21:55
Has anyone used the keyin$() function in 3GL code? It seems to work, but the error dialog box pops up with "Object 0 in process xx not found". Error doesn't stop any functionality, but it cannot go to production like this. Any alternate way of giving the user a way to opt out of a long process in 3GL?
baan_guru
24th March 2011, 06:41
Hi,
Can u post ur script.
All the Best!!!
günther
24th March 2011, 10:28
Hi,
the man page of keyin$() mentions events - and on the events pages there is a short example which might you help to replace keyin$() with about 10 lines of code.
I could imagine that the oject 0 is mwindow or somehting like that.
Günther
steveauckly
24th March 2011, 14:44
Here is the code. Basically, the user is searching two fields for a string they enter. For any orders that match this string, they are added to a listbox. With the keyin$(99) function, I am trying to give them a way out rather than waiting.
select tssma950.*
from tssma950
selectdo
select tssma301.*,
tccom013.*
from tssma301,
tccom013
where tssma301._index1 = {:tssma950.orno}
and tssma301.cmba refers to tccom013 unref clear
and tssma301._compnr = :tssma950.pfg.comp
selectdo
if pos(tssma950.track,l.search.str) > 0 then
orders.found = orders.found + 1
order.to.listbox()
else
if pos(tssma301.refa,l.search.str) > 0 then
orders.found = orders.found + 1
order.to.listbox()
endif
endif
endselect
if keyin$(99) = chr$(27) then
i = i + 1
s.lbox.line = "Stopped searching - ESC key"
detail.to.listbox(i)
break
endif
endselect
steveauckly
24th March 2011, 17:55
This is my workaround since keyin$() doesn't work in 3GL. I added a counter, l.ord.count, so it doesn't go through this code every order. This is outside the main event loop of my 3GL session, inside of a function that can take a while to run which is why I wanted to give the user a way to get out of it faster.
if l.ord.count = 500 then
timer.id = set.timer(100)
on case next.event(event)
case EVTTIMEREVENT:
| esc not pressed, continue on
break
case EVTKEYPRESS:
on case evt.keypress.key(event)
case KEY_ESC:
i = i + 1
s.lbox.line = "Stopped searching - ESC key"
detail.to.listbox(i)
esc.pressed = True
break
endcase
endcase
kill.timer(timer.id)
l.ord.count = 0
endif