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
[43460] Re:[질문] TTrackBar의 OnChange 이벤트 관련
소리바람.OJ [phonon] 1040 읽음    2006-01-26 18:42
TTrackBar에는 마우스에 대한 이벤트가 없습니다.
그래서, 상속 받아서 만들어 봤습니다.

//--- Unit1.h ---
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TMyTrackBar : public TTrackBar
{
__published:
    __property OnMouseDown;
    __property OnMouseUp;
    public:
    __fastcall TMyTrackBar(HWND ParentWindow) : TTrackBar(ParentWindow){}
};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
    TButton *Button1;
    void __fastcall FormCreate(TObject *Sender);
private:    // User declarations
    TMyTrackBar *myTB1;
    void __fastcall MyTrackBarMouseUp(TObject *Sender,TMouseButton Button,
     TShiftState Shift, int x, int y);
public:        // User declarations
protected:
    __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
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::MyTrackBarMouseUp(TObject *Sender,TMouseButton Button,
     TShiftState Shift, int x, int y)
{
   ShowMessage("Good");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
    myTB1 = new TMyTrackBar(Form1);
    myTB1->Parent = Form1;
    myTB1->Left = 100;
    myTB1->Top = 100;
    myTB1->OnMouseUp = MyTrackBarMouseUp;
}
//---------------------------------------------------------------------------


건승을 빕니다.


김정현 님이 쓰신 글 :
: Trackbar의 slider를 움직이면 OnChange 이벤트가 항상 발생하는데요...
: VC++의 Slider에 있는 ReleasedCapture 이벤트 같은 slider를 움직이다가 멈췄을 경우에만
: 발생하는 이벤트는 없나요?
:
: 도와주삼~~~~ ㅠㅠ

+ -

관련 글 리스트
43458 [질문] TTrackBar의 OnChange 이벤트 관련 김정현 917 2006/01/26
43460     Re:[질문] TTrackBar의 OnChange 이벤트 관련 소리바람.OJ 1040 2006/01/26
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.