Editing a New() CString in a Window Text Control

Hi,

I’m trying to get the ability to edit some files with code (SQL, not that it matters) in a window in Clarion. A fair number of those files are over 4K in size (the largest at the moment is 32K).

If I have a CSTRING declared at its maximum size (4K) and add that to the window, everything is hunkydory (except for I’m missing the end of some files), like:

sqltext  cstring(4000)

window
  ...
 text...,use(sqltext)
end

code

open(window)

all works perfectly

But

sqltext  &cstring

window
  ...
 text...,use(sqltext)
end

code

sqltext &= new cstring(4000)
open(window)

crashes on opening the window.

I’m doing this in an APP, not a hand-coded exe but I’m pretty sure it is merely the change to the cstring reference that causes the app to just go away on trying to open the window. Is there a way to do what I want? Am I missing something simple? I really don’t want to have to deal with the file as a queue of chunks that I can see only one at a time.

@jslarve knows how to do this… IIRC

  1. Do Not declare Use(SqlText) instead Use(?TxtFeq)
  2. After window is open ?TxtFeq{PROP:Use}=SqlText
  3. Before window close ?TxtFeq{PROP:Use}=''
sqltext  &cstring

window  window('...
  text...,use(?TxtFeq)
end
  code
  sqltext &= new cstring(4000)
  open(window)
  ?TxtFeq{PROP:Use}=SqlText
  Accept 
      .... 
  End
  ?TxtFeq{PROP:Use}='' 
  Close(window)
  Dispose(Sqltext)

Thanks Carl,

I did set up a little handcoded thing just to check it was the cstring ref and the window open that was the culprit (which it was).

Tried what you posted there and it worked fine, so should be fine in the app too!

Many thanks,

Jon

The same idea applies for FROM() as well.

Not at my computer, but pretty sure you can declare a cstring > 4k.

I “assumed” he was talking about 4m, but you could be right.