Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 21 AUG 2003 12:28:15PM Gerald Lovel wrote:

I have an MDI frame with child windows A and B. Window A browses cursor 1 showing records from table A. Window B browses cursor 2 showing records from table B.

From window A, I wish to use the active cursor temporarily in some other process, say a viewer popup. So I make a temporary copy of the cursor with the following code:

TempCursor=0
ClearSelect TempCursor
Select.Seek( Seek$Top, Cursor, 0, Flag )
Swap.Cursor( Cursor, TempCursor, Swap$Copy )
... (temporary process follows)

Where, Cursor=1, Seek$Top=0, and Swap$Copy=2. When the temporary process finishes, I continue to browse cursor 1 in window A without problems.

Next I change focus to window B, where cursor 2 is active, and the correct list is being browsed. Again, I call my temporary process code, where this time cursor=2.

After which, I discover that Window B is browsing keys from cursor 1, table A. Woah, Nelly! What happened here?

(Questions or comments about the Select.Seek and SwapCursor routines are welcome.)

Gerald

glovel@wares.cc


At 24 AUG 2003 03:06PM Gerald Lovel wrote:

Did some more testing on this. Started windows A and B. Performed a select into cursor 0 in window A, and used SWAP.CURSOR to copy the results into cursor 1. Switched to window B. Cleared cursor 0, performed a select into cursor 0, and used SWAP.CURSOR to copy the results into cursor 2.

I can tell you that window A, browsing cursor 1, loses its list when any other process clears or uses cursor 0. Therefore SWAP.CURSOR is moving the pointers around in @CURSORS, but the internals where the key list resides is still associated with cursor 0. If SWAP.CURSOR could really move a cursor pointer and its list from 0 to another cursor, it would be very nice.

Many commands work with cursor 0 only. This is actually a good thing, because cursor 0 always terminates when BASIC exits. So if you need a temporary cursor for a command or a BASIC routine, you can be assured that cursor 0 is available (until BASIC becomes multithreaded?). But once a select or list operation which is limited to cursor 0 returns a cursor, there needs to be a way to pass that cursor on to a persistent process such as a window. Making a cursor persistent means transferring ALL its information into the new cursor, not just SOME of the pointers.

Of course, I can use my CURSOR2LIST routine to make a key list from from the cursor (ugh). Somehow my enthusiasm for this solution is limited. Any reason why SWAP.CURSOR can't be made to work?

Gerald

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/e53542bce3e2e82f85256d89005a7a5d.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1