|
오~ 예제코드로 아주 잘 설명해주셔서 대단히 감사합니다^^
오늘도 몰랐던거를 하나 알게되었네요^^ 그래서 너무 기쁩니다^^
답변해주신 유영인 님 항상 좋은일만 가득하세요^^
유영인 Cuperido 님이 쓰신 글 :
: ComponentState.Contains(csDesigning) 이 참이면 디자인 타임입니다.
: 아래 예제는 TestValue 라는 속성이 바뀔때 디자인타임에서 바뀌었는지
: 런타임에서 바뀌었는지 보여주는 예제입니다.
:
:
: cuperido
:
:
: * 헤더파일 *
: //---------------------------------------------------------------------------
:
: #ifndef TestButtonH
: #define TestButtonH
: //---------------------------------------------------------------------------
: #include <SysUtils.hpp>
: #include <Controls.hpp>
: #include <Classes.hpp>
: #include <Forms.hpp>
: #include <StdCtrls.hpp>
: //---------------------------------------------------------------------------
: class PACKAGE TTestButton : public TButton
: {
: private:
: bool FTestValue;
: protected:
: void __fastcall ChangeTestValue(bool blValue);
: public:
: __fastcall TTestButton(TComponent* Owner);
: __published:
: __property bool TestValue = {read=FTestValue, write=ChangeTestValue, nodefault};
: };
: //---------------------------------------------------------------------------
: #endif
:
:
: * 소스파일 *
: //---------------------------------------------------------------------------
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "TestButton.h"
: #pragma package(smart_init)
: //---------------------------------------------------------------------------
: // ValidCtrCheck is used to assure that the components created do not have
: // any pure virtual functions.
: //
:
: static inline void ValidCtrCheck(TTestButton *)
: {
: new TTestButton(NULL);
: }
:
: //---------------------------------------------------------------------------
: __fastcall TTestButton::TTestButton(TComponent* Owner) : TButton(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TTestButton::ChangeTestValue(bool blValue)
: {
:
: FTestValue = blValue;
:
: if(ComponentState.Contains(csDesigning))
: ShowMessage("값 변경 (Design Time)");
: else
: ShowMessage("값 변경 (Run Time)");
:
: }
:
: //---------------------------------------------------------------------------
:
: namespace Testbutton
: {
: void __fastcall PACKAGE Register() {
: TComponentClass classes[1] = {__classid(TTestButton)};
: RegisterComponents("Samples", classes, 0);
: }
: }
:
: //---------------------------------------------------------------------------
:
:
: 차베스 님이 쓰신 글 :
: : 안녕하십니까^^
: : 더운 여름날에도 불구하고 수고들 많으십니다.
: : 다름이 아니옵고, 조그마한 컴포넌트를 하나 제작하려 하는데,
: : 디자인모드에서는 기능중 일부만 작동을 하고,
: : 런타임모드에서는 모든 기능을 작동하게 하려 합니다.
: : 그렇게 하려면, 현재 시점이 디자인타임인지, 런타임인지를
: : 알아내야 할 것 같은데, 어떻게 알아내는지요?
: :
: : 컴포넌트 속성으로 아예 설정을 해 버리니깐,
: : 런타임이면 완전 런타임이 되어 버려서, 두가지 기능을 다 하지를 못하게 되더군요...
: :
: : 코딩중에 현재가 런타임인지, 디자인타임인지 감지하는 방법이 있을것 같은데...
: : 그 방법이 어떤것이 있는지 아시는분 좀 설명좀 부탁드리고자 합니다.
: : ^^ 예제 소스라도 제시해 주시면 더더욱 감사하구요 ^^
: : 그럼... 수고 하십시오^^(꾸벅~)
|