Hi folks,

I have massive problems using MetaKit with Tcl (ActiveTcl 8.4.5).

I have "connected" a tktable and a view so that all search and sort operations 
are done in the database and results are copied to tktable.
Now I wanted to search a pattern in all "cells" and bring all hits to the top 
of the view:

----------------------------------------------------------------
# $v = view path
# $proplist = list of properties in $v (all props are strings)
# $s = search pattern

# Searching property by property 
# Q: Is there a better way to search ?
set hits {}
foreach i $proplist \
{
  set hits [concat $hits [mk::select $v -first 2 -glob $i $s]]
}
# Eliminiate double hits and sort
set hits [lsort -unique -integer $hits]

# Now move all hits to top of view
# To reach this, swap dest and nr and then increment dest
# dest starts with row 2 because row0 keeps the row titles and
# row1 the column width in pixels
set dest 2
foreach nr $hits \
{
  # Save destination row content to temporary row
  eval "set cur1 \[mk::row create [mk::get $v!$dest]\]"

  # Copy the hit there
  mk::row replace $v!$dest $v!$nr

  # And copy now the "clipboard" to the old hit row
  mk::row replace $v!$nr $cur1

  # Set the pointer to next row from top
  incr dest
}
# Write all values from db to table
UpdateTable
# And select search results
$table selection set 1,0 [llength $hits],[$table cget -cols]
------------------------------------------------------------------

Well, when swapping the rows, this script crashes with seg fault.
I had a look at the row contents and the search results - all is fine, but 
after the second or third iteration over nr it always crashes :-/

What I'm doing wrong? Have I misunderstood the mk::cursor command or
their use?

It really drives me to despair cause it's not the first seg fault with mk4tcl 
- isn't it possible to use property names with blanks?

Any help would be great!

Best regards,
Christoph (frustrated) :-(

_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to