PE Programming for dummies

Anything QL Software or Programming Related.
User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: PE Programming for dummies

Post by tofro »

I played around bit with my PE test loop and found the following (at least on QPC):
  1. Cursor keys are not considered "keys" as such in pure PTR programs as yours (it's different in WM programs, though. In an application subwindow, you can perfectly catch them as keys)
  2. Instead of being keys, they are considered pointer move commands (in CKEYON mode)
  3. Other than in CKEYON mode, I can't seem to be able to make RDPT terminate at all on cursor keys. RDPT seems to ignore them completely. In CKEYON mode, RDPT returns a pointer move notification with no key press
  4. If I place a KEYROW 1 directly after the RDPT call, I seem to be safely able to catch cusor key presses. I think that should be a solution to your problem
Another option would be to step up a notch and write a Window Manager Program instead of a PE one.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Andrew
Aurora
Posts: 796
Joined: Tue Jul 17, 2018 9:10 pm

Re: PE Programming for dummies

Post by Andrew »

tofro wrote: Thu Jan 04, 2024 9:25 pm [*]If I place a KEYROW 1 directly after the RDPT call, I seem to be safely able to catch cusor key presses. I think that should be a solution to your problem [/list]
Yes, that works like a charm! Thank you, tofro.
Now I just have to find out why some keypresses are read very fast while other need a longer keypress or several keypresses (it is not about the key that is pressed)
tofro wrote: Thu Jan 04, 2024 9:25 pm Another option would be to step up a notch and write a Window Manager Program instead of a PE one.
Honestly, I have no clear ideea what's the difference between a wman program and a PE program.

What I am trying to achieve: add "quick and dirty" mouse support to QL Commander without having to rewrite it as a PE program.
Yes, I know, in the long run it would be better to rewrite it, but I do not have the necessary mood now. Also I hate the PE scrollbars.

Also I added some FileInfo2 support to QLCommander. Which raises other questions:
If an extension has several actions associated with it (e.g. View, Edit, Delete, Move)
- is it possible to call a specific extension? (Call View when user clicks on View button, call Edit when user clicks on Edit button)
- is it possible to at least hide some actions (hide View and Move, but show the menu with View and Edit)


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

Re: PE Programming for dummies

Post by tofro »

Andrew wrote: Thu Jan 04, 2024 10:28 pm Also I added some FileInfo2 support to QLCommander. Which raises other questions:
If an extension has several actions associated with it (e.g. View, Edit, Delete, Move)
- is it possible to call a specific extension? (Call View when user clicks on View button, call Edit when user clicks on Edit button)
- is it possible to at least hide some actions (hide View and Move, but show the menu with View and Edit)
I'm not sure what you're trying to do: Are you referring to the menu selection that opens when a file has more than one action?

You can
  • Ask fi2 for the number of possible actions configured for a file

    Code: Select all

    num = fi2_actn% ("win1_boot")
    (This returns 3 on my systems, as I have 3 possible editors configured for files with no extension)
  • Then enumerate the possible actions

    Code: Select all

    for i = 1 to num : print fi2_parm$(5, "win1_boot", i
    
    This prints the 3 selection meu entries
But that's about it. As FI2 has no concept what the actions actually are or do it cannot know which would be the "view" or "move" (because it could be named "osservare", or "desplazar", "If you want to move it, move it!", or "Show me what you got" - Or, even worse, it could be "Delete" and "Format") there's no way I can imagine you can achieve what you want to do. FI2 is so widely configurable that it needs human decisions on what you want to do with a file.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
desin
Chuggy Microdrive
Posts: 54
Joined: Mon May 10, 2021 10:33 am

Re: PE Programming for dummies

Post by desin »

Hello Andrew
page 69 of the EASYPTR Manual section RDPT
Termination Vector
mentions a value 2 for key down and a value 4 for key up
but i have not figured out yet how it works

as for the FI2 choices what do to with a file
you can use LIST_SELECT to present them
as in my adr.bas
viewtopic.php?p=45397#p45397

Greetings from Switzerland
Markus


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

Re: PE Programming for dummies

Post by dilwyn »

I think that those test for mouse key (mouse button) rather than cursor arrow keys.


User avatar
Andrew
Aurora
Posts: 796
Joined: Tue Jul 17, 2018 9:10 pm

Re: PE Programming for dummies

Post by Andrew »

desin wrote: Fri Jan 05, 2024 10:25 am Hello Andrew
page 69 of the EASYPTR Manual section RDPT
Termination Vector
mentions a value 2 for key down and a value 4 for key up
but i have not figured out yet how it works
RDPT was the first thing I tried (see the test code on the previous page), but it doesn't work for cursor keys. As Tofro explained, Cursor keys are not considered "keys", but cursor movement.
desin wrote: Fri Jan 05, 2024 10:25 am as for the FI2 choices what do to with a file
you can use LIST_SELECT to present them
as in my adr.bas
viewtopic.php?p=45397#p45397

Greetings from Switzerland
Markus
I downloaded it and I will study it.
But I am pretty sure that what I want is not achievable, as tofro confirmed in his reply.


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

Re: PE Programming for dummies

Post by dilwyn »

Yes, I've had a tinker this morning and agree it can't be done with anything I've tried so far other than with KEYROW (unless someone comes up with some lateral thinking on this), though that introduces quite an overhead with frequent key scanning.

Looks like you can't test for space and enter either with PVAL and RDPT, as those are swallowed as Hit and Do. I only did one quick test routine in QPC2, so treat that "finding" cautiously.

Was instructive in the sense of re-learning how to use the termination vector parameter combinations for RDPT which Markus mentioned.


User avatar
desin
Chuggy Microdrive
Posts: 54
Joined: Mon May 10, 2021 10:33 am

Re: PE Programming for dummies

Post by desin »

hello Andrew
Fileinfo2 has it all ready for use
read the doc
https://morloch.hd.free.fr/smsq/Area02/FI2v3e50.zip

FI2_Call "Win1_boot",5

Greetings from Switzerland
Markus


User avatar
Andrew
Aurora
Posts: 796
Joined: Tue Jul 17, 2018 9:10 pm

Re: PE Programming for dummies

Post by Andrew »

desin wrote: Fri Jan 05, 2024 1:25 pm hello Andrew
Fileinfo2 has it all ready for use
read the doc
https://morloch.hd.free.fr/smsq/Area02/FI2v3e50.zip

FI2_Call "Win1_boot",5

Greetings from Switzerland
Markus
Thank you Markus, I already did that.
In fact I use error_code=FI2_FCALL(a$,6) or error_code=FI2_FCALL(a$,8)
If I use error_code=FI2_FCALL(a$,5) the menu is presented, but the command line is not passed to the processing job, so the file is not loaded.
My question was if it is possible to hide some of the action from the menu, as I do not want the user to delete/move anything outside of my program, but now I know it is not possible.
Untitled-2.jpg


User avatar
pjw
QL Wafer Drive
Posts: 1316
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: PE Programming for dummies

Post by pjw »

Andrew wrote: Thu Jan 04, 2024 10:28 pm <>
Also I added some FileInfo2 support to QLCommander. Which raises other questions:
If an extension has several actions associated with it (e.g. View, Edit, Delete, Move)
- is it possible to call a specific extension? (Call View when user clicks on View button, call Edit when user clicks on Edit button)
- is it possible to at least hide some actions (hide View and Move, but show the menu with View and Edit)
No. And this is a serious omission in FI2. You can get the names, actions
and other info of all the items in an extension's list, but when it comes
to calling an action you have only two possibilities: Effectuate the first
action (if theres only one action associated with the extension) or get
presented with a mickymouse menu - that hogs the whole screen! - and make
your selection from there. There is no easy way for you to get your program
to select a specific action or make your own menu with only a selection of
actions.

There are two work-arounds though:

1) You can configure FI2 to only present certain actions for a given
program and not in others. The downside is that it is rather inflexible,
you still get the mickymouse menu, and you have to get each of your
"customers" to do the same jiggery-pokery to their copy of FI2.

2) You re-implement all the actions in S*BASIC. Depending on how much of
FI2 you wish to mimic in your program, this can mean quite a lot of work.

FI2 has all the information you have configured for each extension, and
very kindly lets you easily access it. All you would have to do it to parse
and interpret all that information and then carry out the required action
yourself.

I have done all this a few times but never made a "universal FI2
action emulator". The part I published on Knoware.no leaves that bit out.
Depending on your requirements that may be nearly enough.

I have written to Thierry twice to ask him to update FileInfo2. After all,
all the information is already present AND FI2 knows how to interpret and
execute that information. It really cant be hard to add that option, and
one can but wonder why it was omitted. However, Ive had no response.
If anyone has contact with Thierry, perhaps they could give it a nudge..

Since Knoware.no is currently in hibernation I could drop what I have on
the topic here if there were any interest..


Per
dont be happy. worry
- ?
Post Reply