[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] Programming question

In message <574f921060bob@xxxxxxxxxxxxxxxx>
          Bob Latham <bob@xxxxxxxxxxxxxxxx> wrote:

> In article <626a424f57.fjgraute@xxxxxxxxx>,
>    Fred Graute <fjgraute@xxxxxxxxx> wrote:
> > In message <574f213357bob@xxxxxxxxxxxxxxxx>
> >           Bob Latham <bob@xxxxxxxxxxxxxxxx> wrote:
> > > Assume StrongED has a basemode window open for text only. There
> > > may or may not be text in the window and there may or may not be
> > > an associated file stored somewhere.
> > > 
> > > Is there a way a small program of mine can send text to that
> > > window at the end of file / bottom of the text other than copy
> > > and paste?
> > You can use Wimp_ProcessKey or OS_Byte (138 or 153) to send
> > characters to the window with the input focus. You'll need to place
> > the cursor at the end of the text manually.
> > A more involved way is to send a StrongED_ExecCmds message to
> > StrongED with either the text to insert or the name of a file to
> > insert. See StrongED manual -> Reference section -> List of
> > Messages.
> > In the latter case you can include the EndOfText function to make
> > sure the cursor is at end of text.
> Very interesting, I'll look into both options.

With Wimp_ProcessKey or OS_Byte it should be fairy simple to implement.
Using StrongED_ExecCmds is more complicated so here's some sample code
(in BASIC) to show what's required.

  DIM Block% 256
  REM Set command string and work out its length (rounded up)
  Command$ = "StrongED_ExecCmds EndOfText InsertStr(""Foobar"")"
  MsgLen%  = ((20 + LEN(Cmd$)) + 3) AND NOT %11
  REM Set up message block with command to send
  !(Block%+0)  = MsgLen%  : REM message length
  !(Block%+4)  = 0        : REM task handle
  !(Block%+8)  = 0        : REM my_ref
  !(Block%+12) = 0        : REM your_ref
  !(Block%+16) = &43b00   : REM message code
  $(Block%+20) = Command$ : REM command string
  REM Pass command string to StrongED with a UserMessage
  SYS "Wimp_Initialise",350,&4b534154,"Send StrongED command",0
  SYS "Wimp_SendMessage",17,Block%,0
  SYS "Wimp_CloseDown"

There are a few things to watch out for. If you have multiple copies of
StrongED running then it will only work with one copy (the one that is
first on the OS internal task list).

Also StrongED should not lose input focus. Running the above example
doesn't work on systems where the Filer takes focus on the first click.
On such systems you'll to use an application launcher to start it, eg


StrongED Developer

To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at