C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[45947] Re:채팅 프로그램만드는데 초짜라서 잘 모르겠네요;;
alex [] 1338 읽음    2006-08-01 08:42
Try this. This should capture the key enter on your form.

Set "KeyPreview" to true..

void __fastcall TForm1::FormKeyDown(TObject *Sender, char &Key)
{
if(Key == VK_RETURN) //for enter key
      IdTCPClient1->Connect();
else
  //to do;
}

For Edit1
void __fastcall TForm1::Edit1OnKeyPress(TObject *Sender, char &Key)
{
  //check the char for what you want , othrewise set to Key=0
if (!IsNumeric(Key ))
      Key = 0;
}




킹코브라 님이 쓰신 글 :
: 채팅 동영상 보면서 채팅프로그램을 만들었는데요..;;
:
: 몇개 보완할려고 합니다;;
:
: //---------------------------------------------------------------------------
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner)
:         : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
:    IdTCPClient1->Connect();
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button2Click(TObject *Sender)
: {
:    IdTCPClient1->WriteLn(Edit1->Text);
:    Edit1->Text ="";
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Timer1Timer(TObject *Sender)
: {
:   AnsiString stTemp;
:   if(IdTCPClient1->Connected() == true){
:     stTemp = IdTCPClient1->ReadLn("\n",5);
:     if(stTemp.Length() > 0) Memo1->Lines->Add(stTemp);
:   }
: }
: //---------------------------------------------------------------------------
:
: '전송' 부분을 일일이 마우스로 클릭하지않고 엔터로 쳐서 채팅창에 출력시키고
: 채팅창에 임의의 글자를 입력하지 않게 하는것
:
: 이 두가지를 해결해 주셨으면 감사하겠습니다.

+ -

관련 글 리스트
45946 채팅 프로그램만드는데 초짜라서 잘 모르겠네요;; 킹코브라 957 2006/08/01
45947     Re:채팅 프로그램만드는데 초짜라서 잘 모르겠네요;; alex 1338 2006/08/01
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.