…sorry, I've just noticed that I've used a verb: sw which emulates the
Apple Swift way of embedding values in strings, which I find highly
convenient.
Any J-er will see how to eliminate sw, now you know what it does.

On Sun, May 13, 2018 at 7:14 PM, Ian Clark <[email protected]> wrote:

> The easiest way to respond is to exhibit the verb I'm currently using:
>
> winpos=: 3 : 0"0
>   NB. remember/restore window position
> posfile=: jpath'~config/nuterm.dat'
> select. y
> case. _ do. NB. init caches
>   XYWH=: XYWH0=: 2 650 793 480
> case. 0 do. NB. restore pos from XYWH0
>   XYWH=: XYWH0
>   wd sw'psel nuterm; pmove (XYWH_nut_)'
> case. 1  do. NB. restore pos from posfile
>   XYWH=: XYWH0
>   (0!:0) :: 0: <posfile
>   wd sw'psel nuterm; pmove (XYWH_nut_)'
> case.   do. NB. remember pos
>   z=. 'XYWH_nut_=: ',wd 'psel nuterm; qform;'
>   z fwrite posfile
> end.
> XYWH0 ; XYWH
> )
>
> This works fine for me, though I only really have a need for
>    winpos ''   NB. remember pos
>    winpos 1   NB. restore pos from posfile
>
> The only reason I raised the matter in the first place is that I hate
> reinventing the wheel – it has long-term disadvantages when designing new
> addons. I simply wondered if the facility existed already in the user API
> and I didn't know about it.
>
> Ian Clark
>
>
> On Sat, May 12, 2018 at 1:55 PM, chris burke <[email protected]> wrote:
>
>> ~config/winpos.dat is used by Jqt to remember the positions of some
>> windows. It could be used for wd forms as well.
>>
>> We need to agree on how it should work.
>>
>> Right now we have wd 'pmove x y w h' to set the position. Perhaps we have
>> a
>> new command 'pmoves' (move and save) so that
>>
>>   wd 'pmoves'
>> or
>>   wd 'pmoves x y w h'
>>
>> moves to the saved position for its form id (if any), and the position
>> would be remembered when the form is closed. If there is no saved
>> position,
>> the x y w h argument is used if given.
>>
>>
>> On Fri, May 11, 2018 at 9:11 PM, Ian Clark <[email protected]> wrote:
>>
>> > Over 99% of my computer usage must be on windows pre-defined for me by
>> > other people's software.
>> >
>> > But I develop a lot of utilities – and when that happens, I am (for a
>> > while) the only user in the world of my novel utility. Is that too
>> small an
>> > audience to address?
>> >
>> > I respectfully suggest that if we restrict attention to J users creating
>> > utilities on an iMac making use of wd (windows driver) – in itself a
>> tiny
>> > proportion of computer users, then there is a substantial demand for a
>> > position-remembering feature. At least for those who get bored of
>> dragging
>> > the window from the centre of the screen to its usual place every time
>> they
>> > make it appear.
>> >
>> > But if I'm wrong and it's only me that has a requirement for it (…and
>> maybe
>> > I am, because I can't recall anyone else proposing it) then I shall
>> > continue to use my own homebrew solution.
>> >
>> > I wouldn't have posted, only I spotted ~config/winpos.dat and
>> conjectured
>> > that something or other must be using it (it gets updated daily). I'm
>> not
>> > sure what (…the jqt Term and Edit windows maybe?) but it looks as if
>> it's
>> > designed to support a generic facility.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to