Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
Giu, Alexandre Leclerc

Array of letters and access to "it" with keyboard?

Startbeitrag von Giu am 03.05.2013 18:43

Hi all,

I have 2 "little" problems.

I need to fill a Table control with some records from a table. I want to add to this table control a column, where all records will be "numerated",
A - Record 1
B - Record 2
C - Record 3

Whit this code, I fill the Table Control, but I'm not sure how to "numerate" the first column to consecutive letters.




I imagine "A" should be changed to something like ["A".."Z"].pos(Table.Position) but I'm not sure how to translate this pseudo-code to WLang.

My second problem is, I need my Form capture all key press to parse it (*), and if a letter is pressed, then the Table selection must move to the corresponding record. I don't know how to get this behaviour.

Some help please?


* In Delphi was a property of Forms called "Key Preview". With this property to true, all key press must pass first the Window key press events.


Hi Giuseppe,

1. You can simply use Charact(64+iLineNumber) to numerate, where iLineNumber starts at 1 and iterate for every line.

2. Look at the third example here: http://doc.pcsoft.fr/en-US/?9000126#ELTSPECIAL000323 and use WM_KEYDOWN / UP or WM_CHAR event on the window or the table control to trap the event. (Go in code, then at the bottom of the code window you will find icons, including ...; click and select the WM_KEYDOWN event. Then use KeyPressed()

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 03.05.2013 19:24
Thanks, I will check tomorrow.

But, how to get priority for key_down of the Window over The key_down of table or edit controls if has focus?


von Giu - am 03.05.2013 21:30
Hi again.

Alexander, I tried and worked like a charm, now my table control is filled correctly, but, as I mentioned... There are some way to capture all key presses, independently wich control has the focus? or disable focus is needed?

My Window has an EDIT, and if focus is there, my Window Key_press event is not executed. As I mentioned, in Delphi, forms (Windows) has a property called "Key Preview" for this behaviour, but don't know if Windev has something similar.


von Giu - am 06.05.2013 08:12
Hi Giuseppe,

In WinDev the nearest events you have are these. If you only want the keys for all the controls, you can code it this way:

Trap all key press / char (as you prefere) by adding this in the form's declaration section:

Event(“KeyPreview”,“.*”,0x0102) // WM_CHAR for all controls in the window, exept the window itself

Then create the KeyPreview() procedure with the following code (as an example):

PROCEDURE KeyPreview()

// If between A to Z: cancel the key pressed and do a specific action
IF 65

von Alexandre Leclerc - am 06.05.2013 12:53
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.