[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [StrongED] Programming question
- To: stronged@xxxxxxxxxxx
- Subject: Re: [StrongED] Programming question
- From: Fred Graute <fjgraute@xxxxxxxxx>
- Date: Wed, 31 Oct 2018 13:26:14 +0100
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=casema.nl; s=201809corplgsmtpnl; h=MIME-Version:Message-ID:Subject:To:From:Date; bh=yhShGBVIPOAj733L4E3jRqqACV79ygjoWIY0doXtvBg=; b=if7qmDL5vEc/rI6R5HEed103Fc Cyb4t1vE6Xjgqd8E1eN5cUNFVhYKHlIO3lKloHe7aAckOv+9VPFiUiZd4DcQ3CQcgSFgb21UPgkSm AnvPQiJEzOdIdGdvvh2k+vb8olZ7jvJFw799SB57qE0w5dZg5Dxl9EndiYq955nOIPFyiNz5hxYMp E2m59izYDBBS8mlX7m4uwwelf/3M0lARfvQIA2r11Teoj/7m4U1hmR5DnbhVcemCtfopscqlWzclL UuQmo8z0Pwo9CXz6xX7HP4CBLM5C/stWJxfCf48b3PA2tTs6N5fsSUC+lzE7qrYTi0SrW7sT+s/AQ jpgL0SqA==;
- Envelope-to: stronged@xxxxxxxxxxx
- In-reply-to: <574f921060bob@mightyoak.org.uk>
- List-id: RISC OS StrongED mailing list
- References: <574f213357bob@mightyoak.org.uk> <626a424f57.fjgraute@casema.nl> <574f921060bob@mightyoak.org.uk>
- Reply-to: StrongED@xxxxxxxxxxx
- User-agent: Messenger-Pro/7.06 (MsgServe/7.06) (RISC-OS/5.24)
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"
END
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
StrongMen.
Cheers,
Fred.
--
StrongED Developer
http://www.stronged.iconbar.com/
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://stronged.torrens.org/index.html