Re: [Ql-Users] Auto-hide

2013-04-18 Thread Dilwyn Jones
That was /exactly/ my concern when I asked how did you do that. As far 
as I know, in the

classic PE a ptr read in a background window will just block.

With QPTR, this works (on QPC  SMSQmulator) even when bgio is switched 
off:


100 OPEN_NEW#0,con
110 WINDOW#0,0,0,0,0
120 OUTLN#0,0,0,0,0
130 REPeat lp%
140term%=48
150RPTR #0,xabs%,yabs%,term%,swnum%,xrel%,yrel%,bt$
170IF yabs%SCR_YLIM-50:BEEP 7000,10
180PAUSE 150
190 END REPeat lp%

wolfgang
Great! Thanks. (For anyone wanting info about the RPTR parameters it's on 
page 38 of my QPTR ref guide)


While tinkering with the Easyptr equivalent, I think I may have found a bug 
in Easyptr's RDPT command:


RDPT #chan%,tvec%,xpos%,ypos%

Should return the absolute pointer coordinate in xpos% and ypos% if passed 
positive. It does indeed if pointer position changes for xpos%, but not for 
ypos%, which always keeps the calling value.


ptrmenr_cde 4.09 - just to give Marcel a migraine ;-)

Easily worked around by using DIM pr%(15) : PVAL #chan%,pr% : ypos% = 
pr%(15)


(always assuming it's not a bug in the first place and just me being totally 
stupid as usual).


Dilwyn 


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Dilwyn Jones
Here's my offering for this, using Easyptr in BASIC. Very similar in 
principle to George's offering, but without the clear window covering the 
screen.


100 REMark detect pointer at bottom of screen
110 OUTL#0 : REMark managed window can be any size large enough for 
pointer

120 REMark Termination Vector - RDPT returns on pointer move or keystroke
130 tvec% = 1+8 : REMark keystroke just for Esc to quit
140 DIM pr%(15) : REMark pointer value result
150 REPeat loop
160   RDPT #0,tvec% : REMark read pointer
170   PVAL #0,pr%   : REMark get pointer result
180   IF pr%(6) = 27 THEN EXIT loop : REMark Esc to quit
190   REMark replace BEEP with another procedure, e.g. popup window
200   IF pr%(15) = (SCR_YLIM-1) THEN BEEP 5000,0 : REMark at bottom pixel of 
screen

210 END REPeat loop
220 CLPT #0
230 STOP

This seems to work with any size of window, haven't tried many sizes though. 
Should work with an Easyptr menu too, though not tried that yet. Only run it 
in BASIC job 0 - intend to try it as an SBASIC job and compiled at some 
point. Only tried it in QPC2 3.34beta3 high colour 1440x900 - would be handy 
if it could be tried on other systems to see how it works (or not).


Line 110 sets #0 to be a managed window so pointer requests possible.

Line 130 sets the Termination vector (what causes RDPT to return) to make 
RDPT return (a) if the pointer is moved, (b) if a key is pressed. The latter 
just to let you press ESC to quit when pointer is in this program's window.


Line 140 dimensions an array to hold the pointer values after the RDPT call. 
We would only be interested in pr%(15) which holds the absolute y 
co-ordinate of the pointer.


Lines 160 to 170 summon the pointer (would be interesting to see if using a 
small transparent or 0x0 pointer can be used, just so that the pointer is 
not visible in this program's window.


Line 180 checks if you pressed ESC.

Line 200 does the doings, checking if the pointer is at the bottom pixel of 
the screen. Pr%(15) is the absolute pointer y co-ordinate, while SCR_YLIM-1 
is the lowest pixel on the screen. Since it is hard to position the pointer 
exactly on the bottom line it might be better to do something like IF 
pr%(15)  (SCR_YLIM-4) to allow it to have a small zone instead of a one 
pixel line. If your #0 window is large enough you could add 195 AT #0,0,0 : 
CLS #0,4 : PRINT #0,'x=';pr%(14);',y=';pr%(15) to see the pointer readings 
as they occur.


If line 200 finds the pointer is at bottom of screen it issues a BEEP 
command (just as an example). This can obviously be replaced with a 
procedure to create a popup menu or taskbar or pretty much whatever you 
want. If a popup window is drawn, you could then fall back out of this 
presumably by checking for the pointer out of window event, though I ain't 
tried that.


Finally 220 just clears the pointer working area installed by RDPT to 
restore normality.


One thing I noticed is that with some screen edges the pointer can't 
actually get to the last pixel, probably just depends on the pointer size 
and origin. For example, the right of the screen. In that case you'd have to 
check if it's within that number of pixels of the edge.


Other things I want to try is to see if Termination Vector 64 can be used as 
a window event to detect pointer hitting edge of screen - use RDPT #0\tvec% 
to allow RDPT to return on Window events. Will need to check how these 
events are returned, probably encoded in high bits of one of the standard 
return values somewhere.


Apologies for the long email - have fun breaking the program everyone :o)

Dilwyn Jones 


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Bob Spelten
Op Wed, 17 Apr 2013 12:26:40 +0200 schreef Dilwyn Jones  
dil...@evans1511.fsnet.co.uk:


Here's my offering for this, using Easyptr in BASIC. Very similar in  
principle to George's offering, but without the clear window covering  
the screen.


100 REMark detect pointer at bottom of screen
110 OUTL#0 : REMark managed window can be any size large enough for  
pointer

120 REMark Termination Vector - RDPT returns on pointer move or keystroke
130 tvec% = 1+8 : REMark keystroke just for Esc to quit
140 DIM pr%(15) : REMark pointer value result
150 REPeat loop
160   RDPT #0,tvec% : REMark read pointer
170   PVAL #0,pr%   : REMark get pointer result
180   IF pr%(6) = 27 THEN EXIT loop : REMark Esc to quit
190   REMark replace BEEP with another procedure, e.g. popup window
200   IF pr%(15) = (SCR_YLIM-1) THEN BEEP 5000,0 : REMark at bottom  
pixel of screen

210 END REPeat loop
220 CLPT #0
230 STOP

This seems to work with any size of window, haven't tried many sizes  
though. Should work with an Easyptr menu too, though not tried that yet.  
Only run it in BASIC job 0 - intend to try it as an SBASIC job and  
compiled at some point. Only tried it in QPC2 3.34beta3 high colour  
1440x900 - would be handy if it could be tried on other systems to see  
how it works (or not).

(..)


Seems to work on my QPC2, executed as SBasic job.
Then you have to open a con or scr channel, default size will do.
Works over the whole width, didn't act on the Escape key though.

The Kilgus system sprites I use are all about 20x20 and have their origin  
at the center.
So I have set a margin of SCR_YLIM -10. The arrow is 17px high and has the  
origin at 0x0, so needs more margin.


Working on the lower  right edges can be dangerous.
For SuQcess and SQRview I have set margins for the maximum window size to  
18px (right)  14px (bottom).
With smaller margins you can barely reach the scroll/pan bars and on  
QPC2/SMSQ/m this can lock the pointer below or right of the bars and  
nothing else can be picked anymore.

Killing QPC was the only option.
This is no problem on Aurora or QXL so I suspect that working within a W$  
window has something to do with it.


Bob

--
The BSJR QL software site at: http://members.upc.nl/b.spelten/ql/
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Dilwyn Jones

Seems to work on my QPC2, executed as SBasic job.
Then you have to open a con or scr channel, default size will do.
Works over the whole width, didn't act on the Escape key though.
Esc would only work if my program had the cursor at the time (as I provided 
no other Quit option).


Dilwyn 


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Marcel Kilgus
Dilwyn Jones wrote:
 This seems to work with any size of window, haven't tried many sizes though.
 Should work with an Easyptr menu too, though not tried that yet. Only run it
 in BASIC job 0 - intend to try it as an SBASIC job and compiled at some
 point. Only tried it in QPC2 3.34beta3 high colour 1440x900 - would be handy
 if it could be tried on other systems to see how it works (or not).

This mechanism only works on my recent pointer environments where
background I/O is enabled. It might always work with a 0x0-sized
window, I guess. Another method to globally get the current mouse
position is what I've described yesterday:

con_linkage = PEEK_L(!;$C4)
mouse_x = PEEK_W(con_linkage + $3c)
mouse_y = PEEK_W(con_linkage + $3c)

 Lines 160 to 170 summon the pointer (would be interesting to see if using a
 small transparent or 0x0 pointer can be used, just so that the pointer is
 not visible in this program's window.

Of course.

 Line 200 does the doings, checking if the pointer is at the bottom pixel of
 the screen. Pr%(15) is the absolute pointer y co-ordinate, while SCR_YLIM-1
 is the lowest pixel on the screen. Since it is hard to position the pointer
 exactly on the bottom line it might be better to do something like IF 
 pr%(15)  (SCR_YLIM-4) to allow it to have a small zone instead of a one
 pixel line.

Actually until (I think) SMSQ/E 3.10 it was completely *impossible* to
position the pointer exactly at the bottom of the screen. I could only
allow this once I had implemented vertical sprite clipping.

 One thing I noticed is that with some screen edges the pointer can't
 actually get to the last pixel, probably just depends on the pointer size
 and origin. For example, the right of the screen. In that case you'd have to
 check if it's within that number of pixels of the edge.

Yes, I didn't do horizontal sprite clipping for some reason. Was
probably too difficult to retro-fit.

Marcel

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Marcel Kilgus
Bob Spelten wrote:
 The Kilgus system sprites I use are all about 20x20 and have their origin
 at the center.
 So I have set a margin of SCR_YLIM -10. The arrow is 17px high and has the
 origin at 0x0, so needs more margin.

Y-direction should be no problem, the sprite can leave the edge of the
screen, so no margin should be needed.

 For SuQcess and SQRview I have set margins for the maximum window size to
 18px (right)  14px (bottom).
 With smaller margins you can barely reach the scroll/pan bars and on  
 QPC2/SMSQ/m this can lock the pointer below or right of the bars and  
 nothing else can be picked anymore.
 Killing QPC was the only option.

Never heard or experienced this.

Marcel

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Tobias Fröschle

Am 17.04.2013 um 17:43 schrieb Marcel Kilgus:

 Dilwyn Jones wrote:
 This seems to work with any size of window, haven't tried many sizes though.
 Should work with an Easyptr menu too, though not tried that yet. Only run it
 in BASIC job 0 - intend to try it as an SBASIC job and compiled at some
 point. Only tried it in QPC2 3.34beta3 high colour 1440x900 - would be handy
 if it could be tried on other systems to see how it works (or not).
 
 This mechanism only works on my recent pointer environments where
 background I/O is enabled. It might always work with a 0x0-sized

That was /exactly/ my concern when I asked how did you do that. As far as I 
know, in the classic PE a ptr read in a background window will just block.

Tobias

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-17 Thread Wolfgang Lenerz

Hi,


That was /exactly/ my concern when I asked how did you do that. As far as I know, in 
the classic PE a ptr read in a background window will just block.


With QPTR, this works (on QPC  SMSQmulator) even when bgio is switched off:


100 OPEN_NEW#0,con
110 WINDOW#0,0,0,0,0
120 OUTLN#0,0,0,0,0
130 REPeat lp%
140term%=48
150RPTR #0,xabs%,yabs%,term%,swnum%,xrel%,yrel%,bt$
170IF yabs%SCR_YLIM-50:BEEP 7000,10
180PAUSE 150
190 END REPeat lp%

wolfgang

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


[Ql-Users] Auto-hide

2013-04-16 Thread Dilwyn Jones
This is a little programming challenge I left with George Gwilt at the Quanta 
workshop this weekend.

I’d like to create something which can behave a bit like an “auto-hide” Windows 
taskbar, using the pointer environment.

If the pointer rests at the bottom of the screen (or any edge for that matter) 
for a couple of seconds, the program or taskbar (or whatever you use it for) 
pops up, even if it was buried under other windows.

Sounds simple: might be simple, I don’t yet know!

Dilwyn Jones
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread George Gwilt

On 16 Apr 2013, at 14:03, Dilwyn Jones wrote:

 This is a little programming challenge I left with George Gwilt at the Quanta 
 workshop this weekend.
 
 I’d like to create something which can behave a bit like an “auto-hide” 
 Windows taskbar, using the pointer environment.
 
 If the pointer rests at the bottom of the screen (or any edge for that 
 matter) for a couple of seconds, the program or taskbar (or whatever you use 
 it for) pops up, even if it was buried under other windows.
 
 Sounds simple: might be simple, I don’t yet know!

Let's see how many different solutions we come up with.

George
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread Bob Spelten
Op Tue, 16 Apr 2013 15:03:28 +0200 schreef Dilwyn Jones  
dil...@evans1511.fsnet.co.uk:


This is a little programming challenge I left with George Gwilt at the  
Quanta workshop this weekend.


I’d like to create something which can behave a bit like an “auto-hide”  
Windows taskbar, using the pointer environment.


If the pointer rests at the bottom of the screen (or any edge for that  
matter) for a couple of seconds, the program or taskbar (or whatever you  
use it for) pops up, even if it was buried under other windows.


Sounds simple: might be simple, I don’t yet know!


It's been done before.
In Cuedark you can assign a corner to act as On switch.
Move the pointer there and the screen saver will be invoked in a few  
seconds.

The principle is the same, don't know how it's done however.
Your taskbar program may need to control the whole screen and  
regularly/constantly check the pointer.


Bob

--
The BSJR QL software site at: http://members.upc.nl/b.spelten/ql/
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Re: [Ql-Users] Auto-hide

2013-04-16 Thread George Gwilt

On 16 Apr 2013, at 14:03, Dilwyn Jones wrote:

 
 If the pointer rests at the bottom of the screen (or any edge for that 
 matter) for a couple of seconds, the program or taskbar (or whatever you use 
 it for) pops up, even if it was buried under other windows.
 
 Sounds simple: might be simple, I don’t yet know!

I've just written a small program which has no window that you can see, has no 
loose items, or indeed anything at all, except that it picks master basic (ID = 
0) when the pointer is moved to the top band of the screen. So yes it seems 
simple.

Of course you would have to supply to this program the ID of the program you 
want picked.


George
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread tobias.froesc...@t-online.de


I've just written a small program which has no window that you can see, has no 
loose items, or indeed anything at all, except that it picks master basic (ID 
= 0) when the pointer is moved to the top band of the screen. So yes it seems 
simple.

Of course you would have to supply to this program the ID of the program you 
want picked.

George,
how did you manage to detect where the pointer is without a window?

Regards,
Tobias


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread George Gwilt

On 16 Apr 2013, at 16:42, tobias.froesc...@t-online.de wrote:

 how did you manage to detect where the pointer is without a window?

By having an invisible window by setting the MSbit of its attributes in the 
window definition. This stops the window being cleared so that you see what's 
beneath it. Ie it's invisible.

The detection is, of course, by setting D2 to 48 for IOP.RPTR

George


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread Wolfgang Lenerz



By having an invisible window by setting the MSbit of its attributes in the 
window definition. This stops the window being cleared so that you see what's 
beneath it. Ie it's invisible.


Very elegant. A 0 sized window will probably do as well.


Wolfgang

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread Norman Dunbar

Hi George,

 By having an invisible window by setting the MSbit of its attributes
 in the window definition. This stops the window being cleared so that
 you see what's beneath it. Ie it's invisible.

Does the invisible window cover the whole screen by any chance? If so, 
what happens to any other program running beneath the invisible window 
when you attempt to click on it with the mouse to pick it to the top of 
the pile?


I remember a program I wrote for Dilwyn some years ago (I can't remember 
the name of it though!) which opened a full-screen window for some 
reason, which effectively disabled using the pointer to pick the other 
running programs.


Dilwyn wasn't best pleased! :-)


Cheers,
Norm.

--
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
Pudsey
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread Ralf Reköndt


- Original Message - 
From: Norman Dunbar


I remember a program I wrote for Dilwyn some years ago (I can't remember 
the name of it though!) which opened a full-screen window for some 
reason, which effectively disabled using the pointer to pick the other 
running programs.


Same with Qascade.
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread George Gwilt

On 16 Apr 2013, at 17:10, Norman Dunbar wrote:

 
 Does the invisible window cover the whole screen by any chance? If so, what 
 happens to any other program running beneath the invisible window when you 
 attempt to click on it with the mouse to pick it to the top of the pile?
 

The window does, I think, cover the whole screen.

I have just tried picking the program (called 'pic') without any effect. Mind 
you its pointer is invisible as well as the window.

 I remember a program I wrote for Dilwyn some years ago (I can't remember the 
 name of it though!) which opened a full-screen window for some reason, which 
 effectively disabled using the pointer to pick the other running programs.


Other programs remain pickable.

George
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] Auto-hide

2013-04-16 Thread Marcel Kilgus
Bob Spelten wrote:
 It's been done before.
 In Cuedark you can assign a corner to act as On switch.
 Move the pointer there and the screen saver will be invoked in a few  
 seconds.
 The principle is the same, don't know how it's done however.

It directly checks pt_pos in the CON linkage block once per second, no
window is involved.

Marcel

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm