FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
How to enable ENTER key in Table to trigger a proc
How to enable ENTER key in Table to trigger a proc
Débuté par Adrianmak, 03 juil. 2018 12:24 - 6 réponses
Connectez-vous…
Adrianmak
#1
Posté le 03 juillet 2018 - 12:24
Dear All,
I'm trying to use ENTER key when user is browsing in a TABLE to launch a proc related to the current row in that table.
I have created a button off window with shortcut as Enter key which works already.
However, problem is there are many other controls in the same window.
Now even the current control is not the table (eg. An Edit date control) and user press enter it will launch it incorrectly.
Please your advise to handle this properly.
I cant find a windev function to test the current active control ie. The table.
Many thanks in advance
Adrian
Signaler
0
0
Bart VDE
#2
Posté le 03 juillet 2018 - 13:01
There is a function ControlCurrent
ControlCurrent
Signaler
0
0
Adrianmak
#3
Posté le 04 juillet 2018 - 09:43
Thank Bart for the pointer.
I do use the function now to detect source of action and it solved the previous problem.
However, a new issue arises. Now when the focus is on another button eg. Close and user press Enter, WD will launch the procedure instead of closing or executing the close code as before.
Seems like the hidden button shortcut (enter) takes precedence over all other controls.
Any advise how to avoid this is highly appreciated.
Thanks again.
Signaler
0
0
Arie
#4
Posté le 04 juillet 2018 - 09:55
Hi Adrian,
you could add the "key pressed" process (wm_char) to your table control and execute your code there. Select the table and press F2 then you can see all processes
IF KeyPressed(VK_RETURN) THEN
your code
END
note that you also have to include this line somewhere. i.e. your project init-section or some other 'global' place
EXTERN "KeyConst.WL"
Signaler
0
0
Adrianmak
#5
Posté le 04 juillet 2018 - 12:21
Many thanks Arie.
I changed to detection method per your suggestion as it is more natural. And it now works perfectly.
Adrian
Signaler
0
0
Adrianmak
#6
Posté le 04 juillet 2018 - 14:33
Hi All,
I just noticed a problem when using key pressed detection on table control.
Normally i want to launch the procedure only when user press Enter while navigating at table row. But now when user type in at the table header for filtering purpose, then press Enter afterward, it will incorrectly launch the proc too.
Kindly advise how to differentiate/recognize user enter-ing from table header so that I can add code to exclude such.
Thanks again
Adrian
Signaler
0
0
DerekT
#7
Posté le 04 juillet 2018 - 19:33
A bit more code but TableInfoXY() may be your friend
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte