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
[48253] Re:Re:SetButton의 기능을 활용해 보고 싶습니다.
빌더맨 [] 885 읽음    2007-03-01 23:19
답변 감사 합니다.
올려 주신 코딩 소스 대로 실행해 보니깐 쉽게 이해도 되고
제대로 된 답도 보았습니다.
수고 하십시요.!

장성호 님이 쓰신 글 :
: 님의 코딩을 보니 특별한 문제가 없었습니다.
:
: 그대로 복사해서 테스트했었는데...
: 에러없이 잘 동작하는군요
:
: 다른곳에서 문제가 발생하지는 않는지 함 찾아보시지요
:
: 혹시나해서 테스트코드를 붙여드립니다. (뭐 특별한것 없지만...)
:
: 그럼..
:
: -----------테스트 소스------------------
:
: @ unit1.h

:          ........
:
: public:        // User declarations
:     __fastcall TForm1(TComponent* Owner);
:
:     void __fastcall TForm1::SetButtons();   //추가내용
: };
: //---------------------------------------------------------------------------
: extern PACKAGE TForm1 *Form1;
: //---------------------------------------------------------------------------
: #endif
:
: @  unit1.cpp
:
: //---------------------------------------------------------------------------
:
: #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::FormCreate(TObject *Sender)
: {
:     for(int i=0;i<5;i++)
:         ListBox1->Items->Add("Item"+IntToStr(i+1));
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Btn_SetButtonClick(TObject *Sender)
: {
:     SetButtons();
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::SetButtons()
: {
:     bool SrcEmpty, DstEmpty;
:     SrcEmpty = (ListBox1->Items->Count == 0);
:     DstEmpty = (ListBox2->Items->Count == 0);
:     Button1->Enabled = (! SrcEmpty);
:     Button2->Enabled = (! SrcEmpty);
:     Button3->Enabled = (! DstEmpty);
:     Button4->Enabled = (! DstEmpty);
:
: //    Button1->Enabled = (ListBox1->Items->Count >0)?true:false;
: //    Button2->Enabled = Button1->Enabled;
: //    Button3->Enabled = (ListBox2->Items->Count >0)?true:false;
: //    Button4->Enabled = Button3->Enabled;
:
: }
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
:     int i;
:     for (i = 0; i < ListBox1->Items->Count; i++)
:     if (ListBox1->Selected[i])
:         ListBox2->Items->AddObject(ListBox1->Items->Strings[i],
:     ListBox1->Items->Objects[i]);
:     for (i = ListBox1->Items->Count - 1; i >= 0; i--)
:     if (ListBox1->Selected[i])
:     ListBox1->Items->Delete(i);
:     SetButtons();
:
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::Button2Click(TObject *Sender)
: {
: int i;
: for (i = 0; i < ListBox1->Items->Count; i++) {
:     ListBox2->Items->Add(ListBox1->Items->Strings[i]);
: }
: ListBox1->Clear();
: SetButtons();
:        
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::Button3Click(TObject *Sender)
: {
: int i;
: for (i = 0; i < ListBox2->Items->Count; i++)
: if (ListBox2->Selected[i])
:     ListBox1->Items->AddObject(ListBox2->Items->Strings[i],
: ListBox2->Items->Objects[i]);
: for (i = ListBox2->Items->Count - 1; i >= 0; i--)
: if (ListBox2->Selected[i])
:     ListBox2->Items->Delete(i);
: SetButtons();
:
: }
: //---------------------------------------------------------------------------
: void __fastcall TForm1::Button4Click(TObject *Sender)
: {
: int i;
: for (i = 0; i < ListBox2->Items->Count; i++) {
:     ListBox1->Items->Add(ListBox2->Items->Strings[i]);
: }
: ListBox2->Clear();
: SetButtons();
:
: }
: //---------------------------------------------------------------------------
:
:
:
:
: 빌더맨 님이 쓰신 글 :
: : 안녕하십니까! 제가 이곳에 올리는 두번째 질문이네요
: :  이번에는 ListBox를 활용하는 문제인거 같은데 이 소스 내용에서
: :  SetButton에 대한 내용을 빼고 실행하면 실행이 되는데
: :  SetButton에 대한 부분을 첨가 하고 실행 하면 에러가 뜨는데 도통 원인 파악을
: :  못하겠습니다. SetButton의 소스 내용과 SetButton 활용 할 수 있는 방법좀
: :  해결 할 수 있게 도와 주십시요. 오늘 하루도 수고 하십시요.

+ -

관련 글 리스트
48234 SetButton의 기능을 활용해 보고 싶습니다. 빌더맨 996 2007/02/28
48236     Re:SetButton의 기능을 활용해 보고 싶습니다. 장성호 916 2007/02/28
48253         Re:Re:SetButton의 기능을 활용해 보고 싶습니다. 빌더맨 885 2007/03/01
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.