PDA

View Full Version : Flextron and On_Key?



DaveR
29-Aug-2024, 03:47 PM
What's the 'Flextron' way of using a shortcut key to pop open a view? The equivalent of


On_Key key_alt+Key_s send keyaction of Tile3

(or OnClick...)

DaveR
29-Aug-2024, 06:10 PM
Should say, Stackoverflow has suggestions, including this https://github.com/ccampbell/mousetrap , but has anybody got a something we should standardise upon?

Samuel Pizarro
30-Aug-2024, 08:13 AM
On regular webapp, the equivalent for windows on_key is AddKeyHandler

cWebBaseUIObject [Procedure AddKeyHandler] (dataaccess.com) (https://docs.dataaccess.com/dataflexhelp/mergedProjects/VDFClassRef/cWebBaseUIObject-Procedure-AddKeyHandler.htm)

It should work for Flextron as well, but never tested.

DaveR
30-Aug-2024, 10:27 AM
On regular webapp, the equivalent for windows on_key is AddKeyHandler

cWebBaseUIObject [Procedure AddKeyHandler] (dataaccess.com) (https://docs.dataaccess.com/dataflexhelp/mergedProjects/VDFClassRef/cWebBaseUIObject-Procedure-AddKeyHandler.htm)

It should work for Flextron as well, but never tested.

Thanks Samuel, knew there had to be something and I vaguely recall that!

I'm moving a DOS point of sale (which of course is under constant tinkering) to a Flextron just so I don't need the webserver. Must say I've never had time to learn this all in depth so every day I work on it I both learn something new and forget what I learned last week...

Dennis Piccioni
30-Aug-2024, 10:32 AM
This is actually in the On_Key doc (https://docs.dataaccess.com/dataflexhelp/mergedProjects/LanguageReference/On_key_Command.htm).

DaveR
30-Aug-2024, 11:08 AM
If I ever get to a DISD/Synergy/EDUC again I owe you a cerveza. Very slick.



//hotkeys for Dashboard

Procedure oOpenTillKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oOpenTill
End_Procedure
Procedure oCloseTillKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oCloseTill
End_Procedure
Procedure oSaleKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oSale
End_Procedure
Procedure oChargeKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oCharge
End_Procedure
Procedure UnHoldKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oUnhold
End_Procedure
Procedure oQuoteKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oQuote
End_Procedure
Procedure oReprintKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oReprint
End_Procedure
Procedure oVoidKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oVoid
End_Procedure
Procedure oGiftRcptKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
Send Onclick of oGiftRcpt
End_Procedure


WebPublishProcedure oOpenTillKey
WebPublishProcedure oCloseTillKey
WebPublishProcedure oSaleKey
WebPublishProcedure oChargeKey
WebPublishProcedure oUnholdKey
WebPublishProcedure oQuoteKey
WebPublishProcedure oReprintKey
WebPublishProcedure oVoidKey
WebPublishProcedure oGiftRcptKey


Procedure OnLoad
Send AddKeyHandler (RefProc(oOpenTillKey)) 79 True False False //O OPEN till caps
Send AddKeyHandler (RefProc(oCloseTillKey)) 90 True False False //Z Close Till caps
Send AddKeyHandler (RefProc(oSaleKey)) 83 False False False //s sale
Send AddKeyHandler (RefProc(oChargeKey)) 67 False False False //c charge
Send AddKeyHandler (RefProc(oUnholdKey)) 85 False False False //u unhold
Send AddKeyHandler (RefProc(oQuoteKey)) 81 False False False //q quote
Send AddKeyHandler (RefProc(oReprintKey)) 82 False False False //r reprint
Send AddKeyHandler (RefProc(oVoidKey)) 86 False False False //v void caps this?
Send AddKeyHandler (RefProc(oGiftRcptKey)) 71 False False False //g giftreceipt
End_Procedure

Samuel Pizarro
30-Aug-2024, 07:39 PM
Another approach you could use as well ti minimize the number os methods to be webpublished , would have a single one with a case logic based on iKey parameter.

single method, single webpublished that handles all of those keys.

DaveR
1-Sep-2024, 09:40 AM
This is actually in the On_Key doc (https://docs.dataaccess.com/dataflexhelp/mergedProjects/LanguageReference/On_key_Command.htm).

I swear I read that page a dozen times, probably assuming anything new would be at the bottom rather than in the second paragraph.

Irony is that I'm always complaining nobody reads what I write either...

Thanks guys

DaveR
2-Sep-2024, 11:06 AM
Another approach you could use as well ti minimize the number os methods to be webpublished , would have a single one with a case logic based on iKey parameter.

single method, single webpublished that handles all of those keys.

Thanks Samuel, yeah, thought of that, once I'd cut and pasted n times.... :cool:

I will be converting to something like that, I'm just at the 'proof of concept stage' and deciding what needs a top-level tile. I intend to build the skeleton POS and delegate the various stages to the other devs to convert from the fairly-well-structured character mode code.

So I was adding a tile at a time, then the associated shortcut and stuff as I went.

It's funny, having done very little webapp stuff but (just about) got the webapp concepts in my head I keep having to remind myself these are windows objects and 'roundtrips to the server' aren't the huge concern that they are in pure webapp.