1 / 10

델파이 기본 문법

델파이 기본 문법. 폼과 사용자 인터페이스. 콤보박스 사용. 주요 속성 ( 콤보박스의 name 을 cb 라고 가정함 ) cb.Items.text : 콤보박스에 추가된 문자열들 cb.text : 콤보박스에 선택한 문자열 주요 메서드 cb.items.Add ( ‘ 문자열 ’ );  문자열을 콤보박스에 삽입 cb.items.Clear;  콤보박스의 내용을 모두 지움. 폼의 종류. 자동 생성 (Auto Create) 폼 어플리케이션이 시작될때 자동적으로 생성되는 폼

kiona
Download Presentation

델파이 기본 문법

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 델파이 기본 문법 폼과 사용자 인터페이스

  2. 콤보박스 사용 • 주요 속성 (콤보박스의 name을 cb라고 가정함) • cb.Items.text : 콤보박스에 추가된 문자열들 • cb.text : 콤보박스에 선택한 문자열 • 주요 메서드 • cb.items.Add(‘문자열’);  문자열을 콤보박스에 삽입 • cb.items.Clear;  콤보박스의 내용을 모두 지움

  3. 폼의 종류 • 자동 생성(Auto Create)폼 • 어플리케이션이 시작될때 자동적으로 생성되는 폼 • Application.CreateForm(TForm1, Form1); • 주로 메인폼에 해당됨 • 동적 생성(Avaliable) 폼 • 코드로 폼을 만들라는 명령을 내려야 생성되는 폼 • 메인폼외의 나머지 추가적인 폼 생성시 사용 • 사용이 끝나면 메모리 해제해야 함.

  4. 폼이 나타나는 방식에 따른 종류 • 모달(Modal)폼 • 해당 윈도우를 종료해야 다른 폼을 사용할 수 있는 폼 예) 파일 열기, 저장 윈도우 • Form1.showModal; • 모달리스(Modaless) 폼 • 현재 활성화된 폼외에도 다른 폼을 사용할 수 있는 폼 예) 파일 찾기 윈도우 • Form1.show;

  5. 동적생성 폼 생성 과정 • Form1에 버튼을 새로 하나 만들어 놓음 • File  New  form 을 눌러서 새 폼(form2) 생성 • View  project manager  • Form2를 Avaliable form으로 이동시킴 5. Unit1에서 File  Use Unit  unit2 선택하여 추가적인 폼을 메인폼에 연결함.

  6. 동적생성 폼 생성 과정 6. form1의 버튼을 더블클릭해서 아래의 내용 입력함. procedure TForm1.Button1Click(Sender: TObject); var fm2 : Tform2; begin fm2 := Tform2.Create(Application); fm2.ShowModal; end;

  7. 모달폼에서의 반환값 * Modalresult 값 에 관한 표 Constant Value Meaning mrNone 0 종료하기전에 디폴트값으로 사용됨. mrOk idOK OK button 누름 mrCancel idCancel CANCEL button 누름 mrAbort idAbort ABORT button 누름 mrRetry idRetry RETRY button 누름 mrIgnore idIgnore IGNORE button 누름 mrYes idYes YES button 누름 mrNo idNo NO button 누름 mrAll mrNo + 1 ALL button 누름 mrNoToAll mrAll + 1 NO TO ALL button 누름 mrYesToAll mrNoToAll + 1 YES TO ALL button 누름

  8. application.MessageBox 의 flag

  9. try ~ finally 구문(예외처리 구문) try // 예외상황 // 발생 구문 finally // 항상 실행해야 하는 구문 end; try form2.showmodal; … finally form2.release; end; 예외상황 구문의 예외상황 발생여부에 상관업이 Finally 절은 항상 실행된다. 주로, 객체의메모리 해제시 사용된다.

  10. try ~ except 구문 try { 예외상황 발생 구문 } except on 예외상황 유형 do 실행문장; end; try Value := x div y; except on EZeroDivide do Value := MAXINT; end; showmessage(inttostr(value)); Try 절의 예외상황발생시 except 절 구문의 on 뒤의 예외상황 유형에 따라서 해당되는 내용을 실행한다.

More Related