Page 4 of 8

Re: EasyPtr4

Posted: Tue Aug 09, 2022 11:53 am
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.

Re: EasyPtr4

Posted: Tue Aug 09, 2022 12:04 pm
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 1238 times

Re: EasyPtr4

Posted: Tue Aug 09, 2022 12:44 pm
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).

Re: EasyPtr4

Posted: Tue Aug 09, 2022 5:31 pm
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.

Re: EasyPtr4

Posted: Tue Aug 09, 2022 6:14 pm
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.

Re: EasyPtr4

Posted: Tue Aug 09, 2022 7:11 pm
by dilwyn
Wouldn't be this by any chance, Norman?
http://www.dilwyn.me.uk/docs/easyptr/eptutor.zip

Re: EasyPtr4

Posted: Tue Aug 09, 2022 8:11 pm
by RalfR
NormanDunbar wrote:I think Tony Tebby wrote great software, but diabolical manuals!
I am sorry, but QPTR was written by Jonathan Oakley.

Re: EasyPtr4

Posted: Wed Aug 10, 2022 7:17 am
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.

Re: EasyPtr4

Posted: Wed Aug 10, 2022 7:18 am
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.

Re: EasyPtr4

Posted: Wed Aug 10, 2022 10:49 am
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.