mark richardson wrote:
proc {SetRC}
   {TextBox index(insert CursorPos)}
   Row:=CursorPos.1
   Col:=CursorPos.2
   {RowText set({Value.toVirtualString @Row 1000 1000})}
   {ColText set({Value.toVirtualString @Col 1000 1000})}
end

Row and Col are global cells.
RowText and ColText are handles to two separate text boxes.

However, it works for the first keypress then i if i keep pressing return i get:

%***************************** failure **************************
%** Tell: 3 = 2
%** procedure 'QTkText,index'

I guess CursorPos is a global variable?
Variables cannot be changed after they have been
assigned a value (=determined).  Oz is unifying
the new value for CursorPos with the existing one,
leading to a clash (unification failure).
I would like to think that using a fresh variable
each time will fix your problem.  Try this (but note
that it's untested):

proc {SetRC}
  CursorPos in
  {TextBox index(insert CursorPos)}
  Row:=CursorPos.1
  Col:=CursorPos.2
  {RowText set({Value.toVirtualString @Row 1000 1000})}
  {ColText set({Value.toVirtualString @Col 1000 1000})}
end

(or, with different syntax:
CursorPos = {TextBox index(insert $)} in ... )


HTH,
Andreas

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users
  • QTk text box mark richardson
    • Re: QTk text box Andreas Franke

Reply via email to