Author |
Topic |
|
Stu Weissman
USA
3 Posts |
Posted - Apr 01 2014 : 13:03:11
|
In Delphi I can compile using ImageEnView1.MouseInteract:=[miZoom,miScroll]; without issue, but in C++ when I use ImageEnView1.MouseInteract =(miZoom,miScroll); I encounter "E2034 Cannot convert 'TIEMouseInteractItems' to 'TIEMouseInteract' "
i am likely to be missing some simple C++ construct and may look silly posting this, but I cannot find any TIEMouseInteract methods to support this assignment...any suggestions appreciated...
thanks much,
Stu-
|
|
spetric
Croatia
308 Posts |
Posted - Apr 02 2014 : 15:26:59
|
ImageEnView1->MouseInteract = TIEMouseInteract()<<miZoom<<miScroll; |
|
|
Stu Weissman
USA
3 Posts |
Posted - Apr 03 2014 : 08:06:18
|
Sinisa, that did the trick, thank you so much! what was I missing here? I could not see the TIEMouseInteract class hierarchy and i would love to understand how the << operator works for this. Is it bit shifting? Can you point me in the right direction for reading up on, I certainly don't expect you to write extended documentation. Again I thank you so much! -Stu
Stu- |
|
|
spetric
Croatia
308 Posts |
Posted - Apr 03 2014 : 15:11:48
|
Operator overloading gives same operator different meaning when applied to different data types.
Operator << when applied to set actually adds element to set, while >> removes element from set.
Operator << when applied to primitives like integer is bit shifting left, while >> is bitshifting right.
When applied to some io-stream, it puts value in stream: cout << "Hello World";
Instruction: ImageEnView1->MouseInteract = TIEMouseInteract()<<miZoom<<miScroll; creates empty set of type TIEMouseInteract and adds two elements in set: miZoom and miScroll.
|
|
|
Stu Weissman
USA
3 Posts |
Posted - Apr 03 2014 : 15:44:02
|
Sinisa,
Thank you for the explanation. I understand the overloading, what I missed was two things. The first was that unlike the TImageEnIMView.IO object, the MouseInteract had to be explicitly created with the constructor. It did not appear to be in the demo Delphi code I looked at, but perhaps I may have missed something. Also, I mentioned the Class Hierarchy because the ImageEn documention states: type TIEMMouseInteract = set of TIEMMouseInteractItems so I was looking for a Set or TSet parent to TIEMMouseInteract but did not see that nor the Template that I now found by a google search in the Embarcadero C++ doc.
I have spent the last 12 years working primarily on a huge application that supports local law enforcement. It was written in Builder 6 and uses very few constructs from standard C++. My horizons need to be broadened as I migrate this 400+ form app to XE5, converting Skyline ImageLib ojects to ImageEn.
Again my sincerest appreciation for your knowledge and time taken to help me out.
Stu-
Stu- |
|
|
|
Topic |
|