EasyPtr4

Anything QL Software or Programming Related.
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: EasyPtr4

Post by dilwyn »

Not sure if I'm missing the context here, as I haven't been following this thread too closely.

Probably the easiest way using "vanilla" Easyptr extensions is to use PVAL to ask the system for co-ordinates and dimensions.

Before drawing the "popup" over a menu in channel #channel, do a PVAL command:

DIM pr%(16):PVAL #channel,pr%

pr%(10) and pr%(11) will now contain the x and y co-ordinates respectively of the window of #channel. pr%(8) and pr%(9) will contain the width and height respectively of window #channel. If you find that these return the size of an element (not sure from memory if it follows windows cycling round elements, in which case an MWINDOW #channel,0 may be needed to revert to full menu window before PVAL).

Then a simple calculation based on the width of your popup will let you centre or offset the popup, e.g. MDRAW #popup_window,win1_popup_men,pr%(10)+20,pr%(11)+20 will ensure that the popup menu is drawn 20 pixels from the top left of the window being overlayed.

Suppose that your popup window is pw% pixels wide, ph% pixels high.
px% = pr%(10)+((pr%(8)-pw%)/2)
py% = pr%(11)+((pr%(9)-ph%)/2)
MDRAW #popup_win,win1_popup_men,px%,py%

This is untested, done from memory, based on code used in my programs so typos permitting it should do what you want, assuming I've understood your need correctly.


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: EasyPtr4

Post by dilwyn »

Just tried it on a working setup, it does basically work as long as you know the width and height of the popup menu. Here's an example of what it looks like using two quickly done example menus. Hope this is what you wanted to achieve. Obviously, doesn't take borders and shadows into account, but close enough, at least should enable you to ensure your popups are within the menu they overlay. As BASIC has its own outline which may be larger than your menu, any popup windows can fall outside the underlying menu if the outline is larger than the menus, so you might find in compiled programs that popups can't go outside the outline of the main window - the outline may be set automatically when the first (largest) menu is drawn in the primary channel.
Centering popup menus
Centering popup menus
centremenu.jpg (3.32 KiB) Viewed 1175 times


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: EasyPtr4

Post by tofro »

Martin_Head wrote:
I might be able to read the current pointer position, and pop the window up there. But I don't like that idea.
You don't need to do that. As long as you have saved the menu definition of your popup as "relative" (which is the default), EasyPtr will try and open the popup so that the pointer position is not moved more than absolutely necessary. With the "Pointer position" button in EasyMenu you can set the position of the pointer in the window - EasyPtr will then place the menu "around" that pointer position (assuming the above and you don't specify coordinates to MDRAW).


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: EasyPtr4

Post by Martin_Head »

Thanks for that. I do find EasyPtr a bit heavy going. But then I find all of the Pointer Environment heavy going.

But I think this is the furthest I have ever got trying to program in the Pointer Environment. I've always given up in frustration by now.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPtr4

Post by NormanDunbar »

Martin_Head wrote:...I think this is the furthest I have ever got trying to program in the Pointer Environment. I've always given up in frustration by now.
This was my problem way back many years ago. I remember the thrill of finally having enough money to (a) attend a show and (b) purchase QPAC2. I read the QPAC2 manual on the train going home. My brain leaked out of my ears and got off at the next stop! (I never got it back!)

The PE is a great idea, I think, but a nightmare to actually program unless you have mastered EasyPTR 'n' and/or are called Jochen! The QPTR toolkit helped me a little, but the manual for that was equally as bad/unreadable as QPAC2. I think Tony Tebby wrote great software, but diabolical manuals!

Others may disagree. I think it would be great to see an eBook on programming the PE, in S*BASIC and maybe in Assembly too. I suggest starting with a simple project in S*BASIC then work through creating it, what you are doing and so on. Then, when done, do it again in Assembly. I remember doing a very basic EasyPTR 3 (might have been 2) tutorial in Quanta many years ago. I might still have the docs if you are interested, I'll take a look ad see if I can find them?


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: EasyPtr4

Post by dilwyn »

Wouldn't be this by any chance, Norman?
http://www.dilwyn.me.uk/docs/easyptr/eptutor.zip


User avatar
RalfR
Aurora
Posts: 870
Joined: Fri Jun 15, 2018 8:58 pm

Re: EasyPtr4

Post by RalfR »

NormanDunbar wrote:I think Tony Tebby wrote great software, but diabolical manuals!
I am sorry, but QPTR was written by Jonathan Oakley.


4E75 7000
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPtr4

Post by NormanDunbar »

dilwyn wrote:Wouldn't be this by any chance, Norman?
http://www.dilwyn.me.uk/docs/easyptr/eptutor.zip
Thanks very much Dilwyn, that's the very one.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: EasyPtr4

Post by NormanDunbar »

RalfR wrote:
NormanDunbar wrote:I think Tony Tebby wrote great software, but diabolical manuals!
I am sorry, but QPTR was written by Jonathan Oakley.
Don't be sorry Ralf, today I learned something new!

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: EasyPtr4

Post by Martin_Head »

NormanDunbar wrote:
dilwyn wrote:Wouldn't be this by any chance, Norman?
http://www.dilwyn.me.uk/docs/easyptr/eptutor.zip
Thanks very much Dilwyn, that's the very one.

Cheers,
Norm.
I have been using that to get started. But the step by step instructions don't work quite the same due to changes in EasyPtr4.
I have thought about trying to update it for EASYPtr4, But I would have to know what I'm doing first.

Even most of the demo programs in the EasyPtr4 distribution don't work in QPC2.


Post Reply