Board index » delphi » Accessing a TEdit Box in 2 ways - Student Q
Elisa F Roselli
![]() Delphi Developer |
Sat, 02 Jun 2001 03:00:00 GMT
Accessing a TEdit Box in 2 ways - Student Q
I'm a programming newbie on a crash course which has proceeded from Pascal
to Delphi in two short months. I am currently working on a class project which involves the maintenance and improvement of a programme written by last year's students on the same course. They had to produce a calculator, modelled on the Windows calculator, in Delphi. My immediate task is to work on the interface, making it more attractive and interactive. Last year's lads devised the calculator as taking input by mouse only. The numbers are presented as TButtons arranged on panels - different, overlapping panels for decimal, binary, hexadecimal and octal representations. The system that I inherited reads the captions off the buttons into a TEdit window, along these lines: {///////////////} procedure TForm1.ButtonClick(Sender: TObject); begin with panelChiffre do begin if (ecran.text='0') or (operclic) then ecran.text:="; if length(ecran.text)<20 then ecran.text:=concat(ecran.text,Tbutton(sender).caption); end; operclic:lse; calculfait:lse; end; {///////////////////} where "panelChiffre" is the name of the decimal panel (with similar procedures for the other representation panels) and "ecran" is the name of the TEdit box. Later, these concatenated strings are transtyped into numeric values and read into variables. What I want is to extend the possibilities for the TEdit box "ecran" to accept input by keyboard as well as from mouse-clicks on the number buttons. I also want to add an Edit menu with the common CopyToClipboard and PasteFromClipboard functions so that the calculator-results can be pasted between different applications. For some reason, the fact that the TEdit box is parametered to intercept mouseclicks seems to preclude it accepting simple keyboard input, as by default. Is there any way to tell it to do both, while accepting the limitations on length and other specifications of the procedure for mouse input given above? Forgive me for what must be a really basic question. I'm a little at sea in the vastnesses of Delphi and finding that nothing is ever as obvious as in the classroom demonstrations! : ) Many thanks to anyone who can help Elisa Francesca Roselli Universit Fran?ois Rabelais de Tours |