CPB Mailing List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Event Parameters
=================================================================
Attempt to send #2 because the "reply to" does not seem to work
for this mailing list anymore.
=================================================================
Hjcao,
I recently ran into this problem myself.
You cannot use data types with two words for the type declarations in
your event declaration. "unsigned int" doesn't work.
To get around this, I used the Windows-defined simple types. In my
case I was trying to pass an "unsigned char", which I changed to the
Windows-defined type "BYTE". This solved the problem. I believe the
Windows equivalent to "unsigned int" is "DWORD".
If you don't want to be dependent upon Bill Gates, you can also define
your own "typedef" to create an equivalent to "unsigned int". However,
due to the type pickiness of C++, I just find it easier to adopt the
existing "standard". It eliminates the requirement for extra typecasts
when I use the variables to invoke Win32 functions.
Regards,
Don Gregory
hjcao wrote:
>
> Hello All:
> I define a event named TCellClickEven in my head file.But While compliting this files(*.cpp,*.h) ,It have a error
> named"Simple type expected"
> How to do ?
> //---------------------------------------------------------------------------
> #ifndef ChessMapH
> #define ChessMapH
> //---------------------------------------------------------------------------
> #include <SysUtils.hpp>
> #include <Controls.hpp>
> #include <Classes.hpp>
> #include <Forms.hpp>
> //---------------------------------------------------------------------------
> enum TChessKind { ckGoband, ckChess, ckChineseChess };
> typedef void __fastcall (__closure *TCellClickEvent)(TObject * Sender,unsigned int row,unsigned int
col,TMouseButton Button,TShiftState Shift, int X, int Y);
> lass PACKAGE TChessMap : public TCustomControl
>
> rivate:
> int FRownum;
> int FColnum;
> unsigned int FCellWidth;
> unsigned int FBorderWidth;
> TColor FLineColor;
> // TColor FBackColor;
> TChessKind FKind;
> TBorderStyle FBorderStyle;
> unsiged int FLineWidth;
> TCellClickEvent FOnCellMouseDown;
> TCellClickEvent FOnCellMouseUp;
>
> void __fastcall SetChessKind(TChessKind ck);
> void __fastcall SetBorderStyle(TBorderStyle bs);
> void __fastcall SetLineColor(TColor color);
> unsigned int __fastcall GetLineWidth();
> void __fastcall SetLineWidth(unsigned int widht);
>
> rotected:
> virtual void __fastcall Paint(void);
> virtual void __fastcall PaintAsGoband(void);
> virtual void __fastcall PaintAsChess(void);
> virtual void __fastcall PaintAsChineseChess(void);
> void __fastcall MyMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
> //void __fastcall MyMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
> void __fastcall MyMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
>
> ublic:
> __fastcall TChessMap(TComponent* Owner);
> __property int CellWidth={read=FCellWidth};
> _publised:
> __property Align ;
> __property Color ;
> __property Enabled ;
> __property TChessKind Kind = {read=FKind, write=SetChessKind, default=1};
> __property TBorderStyle BorderStyle = {read=FBorderrStyle, write=SetBorderStyle, default=1};
> __property TColor LineColor = {read=FLineColor, write=SetLineColor, default=0};
> __property PopupMenu ;
> __property Visible ;
> __property BorderWidth={read=FBorderWidth,write=SetBorderWidth,default=10};
>
> // __property TDragDropEvent OnDragDrop ;
> // __property TDragOverEvent OnDragOver ;
> // __property TEndDragEvent OnEndDrag ;
> __property TCellClickEvent OnCellMouseDown={read=FOnCellMouseDown,write=FOnCellMouseDown} ;
> __property OnMouseMove ;
> __property TCellClickEvent OnCellMouseUp={read=FOnCellMouseUp,write=FOnCellMouseUp} ;
> // __property TStartDragEvent OnStartDrag ;
>
> };
> //---------------------------------------------------------------------------
> #endif
>
> thank you
--
--------------------------------------
Donald J. Gregory
Gregory Publishing Company
See our A-Series Documentation Library
at: www.gregpub.com
E-Mail: donald@gregpub.com
---------------------------------------
God invented human government (Gen. 9:6).
The devil polluted it with politics.
W Komornicki's Home Page |
Main Index |
Thread Index