home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!wtrlnd!contrast!postmaster
- From: berend@contrast.wlink.nl (Berend de Boer)
- Newsgroups: comp.lang.pascal
- Subject: Turbo Vision Keys?
- Message-ID: <724065276.AA00687@contrast.wlink.nl>
- Date: Fri, 11 Dec 1992 08:30:12
- Sender: postmaster@contrast.wlink.nl
- Lines: 63
-
- Richard Madison wrote in a message to All:
-
-
- RM> My problem is that I have a screen which has 40 field to
- RM> enter. I don't like that the <ENTER> key accepts all data.
- RM> I would like to be able to use the <ENTER> key to move to
- RM> the next field. I would also like to arrange the keys below
- RM> to do what it says.
-
- RM> KEYS WHAT IT DOES WHAT I'D LIKE
-
- RM> enter accepts data as ok move to the next field
- RM> down arrow move to the next field
- RM> up arrow move to previous field
- RM> left arrow move left in field
- RM> right arrow move right in field
- RM> esc cancel accepts data
-
-
- Not so difficult, but you do, in this way, not conform to the CUA
- standard which is a serious drawback I think. More and more people are
- using CUA compliant UIs. But let's show the code:
-
- What do you have to do?
-
- When the enter key is pressed, it is grabbed by the default button if no
- view did handled it. So the first step
- 1) Do not use the bfDefault flag
- 2) Override the HandleEvent of your dialog.
-
- procedure TMyDialog.HandleEvent(var Event : TEvent);
- begin
- TDialog.HandleEvent(Event); {* kbEnter key not handled *}
- if (Event.What and evKeyBoard <> 0) and (Event.KeyCode = kbEnter) then
- SelectNext(FALSE);
- end;
-
- That's the first one.
-
- The up, down, left and right arrow keys are not so easy. For example the
- left arrow key, you have to check for views at the left, and then
- choosing from that views the first selectable view at the left.
-
-
- The esc key is handled by the default TDialog.HandleEvent. So check for
- the Esc key before TDialog.HandleEvent get it:
-
- procedure TMyDialog.HandleEvent(var Event : TEvent);
- begin
- if (Event.What and evKeyBoard <> 0) and (Event.KeyCode = kbEsc) then begin
- Event.What := evCommand;
- Event.Command := cmOK;
- end;
- TDialog.HandleEvent(Event);
- end;
-
-
- Groetjes,
-
- Berend. (-:
- fido: 2:281/527.23
- email: berend@contrast.wlink.nl
-
-