Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 1 Monat, 2 Wochen
Letzter Beitrag:
vor 1 Monat, 2 Wochen
Beteiligte Autoren:
Adrianmak, DerekT, Bart VDE, Arie

How to enable ENTER key in Table to trigger a proc

Startbeitrag von Adrianmak am 03.07.2018 10: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

Antworten:

There is a function ControlCurrent

ControlCurrent

von Bart VDE - am 03.07.2018 11:01
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.

von Adrianmak - am 04.07.2018 07:43
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"

von Arie - am 04.07.2018 07:55
Many thanks Arie.

I changed to detection method per your suggestion as it is more natural. And it now works perfectly.

Adrian

von Adrianmak - am 04.07.2018 10:21
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

von Adrianmak - am 04.07.2018 12:33
A bit more code but TableInfoXY() may be your friend

von DerekT - am 04.07.2018 17:33
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.