Scrolling arrays

I need to write a piece of code that loops through an array, selects the

current row in an ArrayField and puts up a dialog box. Something like the

following:

for x in 1 to set.Items do

arrayWidget.CurrentRow=x;

// put up question dialog, if yes do some stuff

end for;

The problem I'm having is with the scrolling of the ArrayField. Lets say my

ArrayField has 5 rows and my data set has 20 rows. When it gets to row 6 the

ArrayWidget generates some (focus) events to scroll the array and bring the 6th

row into view. The problem is these events are not processed until my code is

done and control returns back to the event loop. The user sees the first 5

dialog boxes along with their associated rows, but the remaining 15 dialog

boxes are all displayed while row 5 is highlighted. As soon as my code finishes

the system goes wild doing all the scrolling.

Is there some way of forcing the window to process the pending events (the

opposite of PurgeEvents)? I tried posting my own event to trigger the dialog

but it seemed to get processed before the scroll events. Are there multiple

queues for the window? Do the events have different priorites?

For Express users, you can do the same thing with the

ExpressClassWindow.ScrollToIndex() method. I also tried using

arrayWidget.RequestFocus as the documentation notes that CurrentRow is read

only but they appear to have work the same.

Any help would be appreciated.

[1583 byte] By [] at [2007-11-25 5:02:15]
# 1

The trick is to drive the process from the parent window's event loop

instead of from a FOR loop. That way all of the window events will be

handled promptly. You would need to define one or more custom events to

control this process. I envision the parent window event loop would look

something like this:

when <updateButton>.click do

<arrayWidget>.currentRow = 1;

post self.updateCurrentRow;

when self.updateCurrentRow do

// display dialog to update current row here

post self.updateNext;

when self.updateNext do

if <arrayWidget>.currentRow < set.items then

<arrayWidget>.currentRow = <arrayWidget>.currentRow + 1;

post self.updateCurrentRow;

end if;

Of course there are many variations of this scheme that will achieve the

same result.

Kevin Klein

Millennium Partners, Inc.

Milwaukee, Wisconsin, USA

--Original Message--

From: Paul_Krinsky@notes.pw.com <Paul_Krinsky@notes.pw.com>

To: kamranamin@yahoo.com <kamranamin@yahoo.com>

Date: Thursday, February 12, 1998 3:06 AM

Subject: Scrolling arrays

>I need to write a piece of code that loops through an array, selects the

>current row in an ArrayField and puts up a dialog box. Something like the

>following:

>

>for x in 1 to set.Items do

> arrayWidget.CurrentRow=x;

> // put up question dialog, if yes do some stuff

>end for;

>

>The problem I'm having is with the scrolling of the ArrayField. Lets say my

>ArrayField has 5 rows and my data set has 20 rows. When it gets to row 6

the

>ArrayWidget generates some (focus) events to scroll the array and bring the

6th

>row into view. The problem is these events are not processed until my code

is

>done and control returns back to the event loop. The user sees the first 5

>dialog boxes along with their associated rows, but the remaining 15 dialog

>boxes are all displayed while row 5 is highlighted. As soon as my code

finishes

>the system goes wild doing all the scrolling.

>

>Is there some way of forcing the window to process the pending events (the

>opposite of PurgeEvents)? I tried posting my own event to trigger the

dialog

>but it seemed to get processed before the scroll events. Are there multiple

>queues for the window? Do the events have different priorites?

>

>For Express users, you can do the same thing with the

>ExpressClassWindow.ScrollToIndex() method. I also tried using

>arrayWidget.RequestFocus as the documentation notes that CurrentRow is read

>only but they appear to have work the same.

>

>Any help would be appreciated.

>

at 2007-6-29 9:22:56 > top of Java-index,Application & Integration Servers,Integration Servers...