TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Randy Brukardt <[log in to unmask]>
Fri, 25 May 2001 17:04:47 -0500
text/plain (35 lines)
> Let's say I would like to manage a keypress or a mouse click in a windows
> form I created using either the win32ada binding, or Windez. How would I
> about that?   Here's example names for the sake of an example.
> Form:     frmClientEntry
> Control:  txtPhoneNumber   (this is a regular windows' text box).
>           cmdSave          (this is a regular windows' command button).
> say I want ot know when they pressed the "enter" key from that text box.
> and say I want to know if they clicked the Save button so I can save?

Sounds like you need to learn how to program Windows. If you're going to use
Win32Ada (which I do NOT recommend), then you should read a book like
Petzold. Claw contains a couple of tutorials that would help you get started
(in the Introductory version, use the tutorial in the Builder). I don't know
if there is anything for Windex.

To answer your questions specifically, the button is handled by handling the
WM_COMMAND message in the dialog box, usually for the "clicked"

To handle "Enter" in the edit control, you have to subclass the control.
That can be a bit tricky. Claw will do it for you if it is necessary; you
just have to override the When_Character action routine to detect an
<Enter>. I don't know if Windex will do it for you. For Win32, you better
get a book.

A reminder: the Claw Introductory Edition is free for evaluation and for
non-commercial use; download it from

If you're confused by the terminology above, see my first suggestion.