|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
send&receive text with tmemo
hi!
I'm trying to make a procedure that can send&receive text messages using a tmemo control and client/server sockets!! when i send a message I press the enter key: Procedure TfrmMain.memLogKeyPress(Sender: TObject; var key:char); var SendString : String; ResultString : String; begin OKDone := False; FirstRowDone := False; if Key = #13 then begin {Sends Last Line} SendString := memLog.Lines[memLog.Lines.Count-1]; Client1.Write(SendString); ResultString := Client1.ReadLn; memLog.Lines.Add(ResultString); end; {Send Commands} end; but it doesn't work because when I press the enter key, nothing happens!! can you help me please?? thank you!!@ Christian |
|
#2
|
||||
|
||||
|
Most likely it is something to do with the Socket code. This code works fine:
Code:
procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char); var SendString : string; begin if Key = #13 then begin SendString := Memo1.Lines[Memo1.Lines.Count - 1]; ShowMessage(SendString); end; end; When I do this, the message shows up which proves that the code is being triggered when I hit the enter key. I'm pretty certain your problem is elsewhere, but without seeing your code, I cannot tell you where it is.
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#3
|
|||
|
|||
|
I tried your procedure but is not enough!!
I send you my code(that's also yours!!), please help me!! Another question:this program is able to send text strings to other client connected, is possible to send these strings (just in a time) to all the client connected at the moment using the same socket?? Thank You!! Christian |
|
#4
|
|||
|
|||
|
??????
Xian are you trying to make a chat system? can you give me more information on wot you are wanting??? better still add me on msn so we can chat djgalaxy2k@hotmail.com cheers
|
|
#5
|
|||
|
|||
|
memLog-> OnKeyPress
Uncalled --->procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
check ur OnKeyPRess for the memLog ok ... it is blank.. :-) Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > send&receive text with tmemo |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|