System.Types and Point

XE7

I have a variable grid of type TRect and this code:

grid := Rect(CGrid.ClientToScreen(Point(0, 0)),
         CGrid.ClientToScreen(Point(CGrid.Width, CGrid.Height)));

This gives a hint when compiled saying inline function point has not 
been expanded because System.Types is not in the uses clause.

If I add that unit I get an incompatible types integer and point error 
and it does not compile.

Can somebody explain what is happening.  I know it works OK if I remove 
the System.Types unit but I use Point in other places and have the 
System.Types unit in the uses clause so as I do not understand why the 
error occurs I am concerned that the unit may be doing something that 
could cause me a problem that I have not yet noticed.
0
Lorne
7/5/2015 3:01:35 PM
embarcadero.delphi.general 4258 articles. 0 followers. Follow

3 Replies
933 Views

Similar Articles

[PageSpeed] 28
Get it on Google Play
Get it on Apple App Store

Lorne Anderson wrote:

> XE7
> 
> I have a variable grid of type TRect and this code:
> 
> grid := Rect(CGrid.ClientToScreen(Point(0, 0)),
>          CGrid.ClientToScreen(Point(CGrid.Width, CGrid.Height)));
> 
> This gives a hint when compiled saying inline function point has not 
> been expanded because System.Types is not in the uses clause.
> 
> If I add that unit I get an incompatible types integer and point
> error and it does not compile.

There are several Rect() functions. The function Rect() declared and
defined in System.Types expects 4 integers. So if you intend to use
another function Rect (e.g. the overloaded function declared in
System.Classes, of which one overload takes two TPoints instead of four
Integers), you will either

- have to put System.Classes *after* System.Types in the uses clause,
so the declarations in System.Classes hide the declaration in
System.Types

or

- have to qualify System.Classes.Rect(CGrid.Client... etc., so it is
clear to the compiler you mean one of the overloaded functions in
System.Classes.

You can choose which you prefer. The latter is not subject to any
changes in the uses clause (except if you'd remove System.Classes, of
course), so IMO it is more robust.
-- 
Rudy Velthuis        http://www.rvelthuis.de

"To err is human - and to blame it on a computer is even more so."
 -- Robert Orben
0
Rudy
7/6/2015 1:27:08 AM
On 06/07/2015 02:27, Rudy Velthuis (TeamB) wrote:
> Lorne Anderson wrote:
>
>> XE7
>>
>> I have a variable grid of type TRect and this code:
>>
>> grid := Rect(CGrid.ClientToScreen(Point(0, 0)),
>>           CGrid.ClientToScreen(Point(CGrid.Width, CGrid.Height)));
>>
>> This gives a hint when compiled saying inline function point has not
>> been expanded because System.Types is not in the uses clause.
>>
>> If I add that unit I get an incompatible types integer and point
>> error and it does not compile.
>
> There are several Rect() functions. The function Rect() declared and
> defined in System.Types expects 4 integers. So if you intend to use
> another function Rect (e.g. the overloaded function declared in
> System.Classes, of which one overload takes two TPoints instead of four
> Integers), you will either
>
> - have to put System.Classes *after* System.Types in the uses clause,
> so the declarations in System.Classes hide the declaration in
> System.Types
>
> or
>
> - have to qualify System.Classes.Rect(CGrid.Client... etc., so it is
> clear to the compiler you mean one of the overloaded functions in
> System.Classes.
>
> You can choose which you prefer. The latter is not subject to any
> changes in the uses clause (except if you'd remove System.Classes, of
> course), so IMO it is more robust.
>
Thanks - all makes sense except for why Embaracero have allowed the same 
function to have 2 different declarations which makes no sense to me at all.
0
Lorne
7/6/2015 8:34:48 AM
Lorne Anderson wrote:

> On 06/07/2015 02:27, Rudy Velthuis (TeamB) wrote:
> > Lorne Anderson wrote:
> > 
> >> XE7
> > > 
> >> I have a variable grid of type TRect and this code:
> > > 
> >> grid := Rect(CGrid.ClientToScreen(Point(0, 0)),
> >>           CGrid.ClientToScreen(Point(CGrid.Width, CGrid.Height)));
> > > 
> >> This gives a hint when compiled saying inline function point has
> not >> been expanded because System.Types is not in the uses clause.
> > > 
> >> If I add that unit I get an incompatible types integer and point
> >> error and it does not compile.
> > 
> > There are several Rect() functions. The function Rect() declared and
> > defined in System.Types expects 4 integers. So if you intend to use
> > another function Rect (e.g. the overloaded function declared in
> > System.Classes, of which one overload takes two TPoints instead of
> > four Integers), you will either
> > 
> > - have to put System.Classes after System.Types in the uses clause,
> > so the declarations in System.Classes hide the declaration in
> > System.Types
> > 
> > or
> > 
> > - have to qualify System.Classes.Rect(CGrid.Client... etc., so it is
> > clear to the compiler you mean one of the overloaded functions in
> > System.Classes.
> > 
> > You can choose which you prefer. The latter is not subject to any
> > changes in the uses clause (except if you'd remove System.Classes,
> > of course), so IMO it is more robust.
> > 
> Thanks - all makes sense except for why Embaracero have allowed the
> same function to have 2 different declarations which makes no sense
> to me at all.

Probably because System.Types is relatively new and is used in all
kinds of system units that do not really need System.Classes.
Redeclaring it allowed them to use it without including the rather big
unit System.Classes.

-- 
Rudy Velthuis        http://www.rvelthuis.de

Finster's Law: A closed mouth gathers no feet.
0
Rudy
7/6/2015 9:24:02 AM
Reply:

Similar Artilces:

ERROR: System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic)
I have searched a lot and almost every person who has reported this error found it while installing the Gallery module and the solution was to remove a section of the .dnn file. However, this is not my case, so, unfortunately, these threads I found have been of little or no help. Please bear with me and offer help if you can, as this is the first time we try using DNN. I am trying to create my own module in DNN 3.2.2 using the dnnJungle VS project templates. I open the DNN source I downloaded from the DNN site that has a total of 35 projects. Compile. Everything OK. I then add...

System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'
Hello , I am a data table with null able Columns.I am not able to catch the value for DBNull. I did set a value to be returned as empty in dataset. Here is the code where i am trying to catch.1 public List GetStores() 2 { 3 List tmpStore = new List(); 4 StoresService.shopDBDataSet.StoresDataTable stores = 5 storesService.GetStores(); 6 for (int i = 0; i < stores.Count ; i++) 7 { 8 Store store = new Store(); 9 store.StoreID = stores[i].StoreID...

System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Byte[]'.
Hi All, I am trying to retrieve a Picture from an SQL 2005 database. Here is my code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ListingID As String = (Request.QueryString("GUID")) 'Connect to the database and bring back the image contents & MIME type for the specified pictureUsing myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionStringListings").ConnectionString) Const SQL As String = "SELECT [Pic1Ext], [Picture1] FROM [Listings] WHERE [ListingID] = @ListingID"C...

System.InvalidCastException: Unable to cast object of type 'System.Web.HttpInputStream' to type 'System.IO.FileStream'
I am trying to create a webpage that takes a file that someone want to upload and chop the file into smaller pieces, and then put back together again.  I have been trying to convert some code I found on Codeproject (FileSplitMerge).  They did it with VB which is what I want to use but it is a project not a web site so...  The problem that I am running into is I keep getting an error when I try to set: FileStream = HttpPostedFile.InputStream (I am using variables in my code) but I keep getting an error of: System.InvalidCastException: Unable to cast object of type 'Sys...

Unable to cast object of type '<>f__AnonymousType1`3[System.Guid,System.String,System.String]' to type 'aspnet_User'.???
Hi everyone, What does this error mean?  ERROR: Unable to cast object of type '<>f__AnonymousType1`3[System.Guid,System.String,System.String]' to type 'aspnet_User'. Thank's a lot /PepePepe JoseNewbie@C#.Net&jRuby What type is in your DataItem?  A Guid? or a String?  Either way, it's telling you cant cast it to a aspnet_User type.  Let us know what your DataItem is and we can help further.Good Luck and happy programming!Let's build community! If my post helped you, mark it as the Answer and I will do the same when you help me.....

System.Web.UI.WebControls.ListItemCollection must have items of type 'System.Web.UI.WebControls.ListItem'. 'asp:TextBox' is of type 'System.Web.UI.WebControls.TextBox'.
I've got an odd request that I just don't know how to handle.   I have a radiobutton list with four radiobuttons.  After the third button, and before the 4th, I need to add a textbox to allow the user to submit some corresponding text.   (I originally just had the text box after the radiobutton group, but they want it moved up into the middle of the radiobutton list.  When I moved the text box to after the 3rd radio group, I get this error.  Any sneaky way to get this accomplished?  My code:  <asp:RadioButtonList ID="rbAns...

System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'. 'asp:hyperlink' is of type 'System.Web.UI.WebControls.HyperLink'.
I have this in my GridView Columns <asp:hyperlink id="Name" datatextfield="FullName" runat="server" />  In my code Behind, I'm trying...at least to set the NavigateURL to a page and then append an ID for each row to the querystring like this:     Sub SearchResults_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)         If e.Row.RowType = DataControlRowType.DataRow Then             Dim hl As HyperLink = CType(e.Row.FindControl("Name"), HyperLink) &nbs...

Object of type 'System.DBNull' cannot be converted to type 'System.DateTime'.
Hi, How can I pass null values to a system.datetime? Thanks in advance for the help J   Below is my code:   Public Class Courses     Public Sub Update_Class(ByVal ClassId As Integer, _    ByVal StatusId As Integer, _    ByVal ClassNumber As Integer, _    ByVal TeacherId As Integer, _    ByVal AmountofParticipants As Integer, _    ByVal CourseDate1 As DateTime, _    ByVal CourseDate2 As DateTime, _    ByVal CourseDate3 As DateTime)     Dim myConnection As New SqlConnection(Conn...

its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager).
Parser Error Message: The base class includes the field 'ScriptManager1', but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager). Line 19: <div class="demo-area">Line 20:   <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" /> I dragged a scriptManager control from the toolbox (also having same problem with an UpdatePanel control), and when I try to run the webapp, I get the error message above - specifically - in the ...

Object of type 'System.Boolean' cannot be converted to type 'System.Int16'.
I have a Checkbox on a detailsview bound to a small int field in my database table.It binds fine when showing the item template on the detailsview, but when I try do an insert/update it blows up with that error.Surely I can bind a checkbox to an integer field, so that unchecked translates to 0, and checked translates to 1?The reason I use a smallint, is its future-proof.  If we decided to switch to a status instead off/on in the future, there are less changes required.  As long as 0 is False and any other value is considered True you should be able to bind the value like this: C...

Unable to cast object of type 'System.String' to type 'System.String[]
 Hey Guys,Am trying to create a system for managing User roles on my site. To do this the user is selected from a gridview (gvMembers) and their info appears in another panel.  The DataKeyNames for this gridview is "UserName". I then have a check box for each role so 1 or multiple roles can be selected. The code behind for updating the roles from one of the checkboxes is shown below:  If ChkAdmin.Checked Then If Roles.IsUserInRole(gvMembers.SelectedValue, ChkAdmin.Text) = False Then Roles.AddUsersToRole(gvMembers.SelectedValue, ChkAdm...

Unable to cast object of type 'System.DBNull' to type 'System.String'.
Hi there, If I add a new event and leave the description field empty the StarterKit seems to throw a big wobbly over the null values in my DB (SQL2000). Have I made a mistake in the installation or something? The problem lies in this line: SharedRoutines.truncate((string)Eval("description")) because description is Null. I want to sort this in this line and I don't want to reply on validators? This is a known issue reported in the Identified Bugs and Fixes for the ClubSite Starter Kit post. I don't think there is one definitive answer. Search on your error message and you'll fin...

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type
I'm getting the following error after converting my site from 1.1 to 2.0:System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'FileTransport.clsFileTransportClass'. COM components that enter the CLR and do not support IProvideClassInfo or that do not have any interop assembly registered will be wrapped in the __ComObject type. Instances of this type cannot be cast to any other class; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface. at Move...

Unable to cast object of type 'System.Int64' to type 'System.String'
Hi friends I am getting the following error..."Unable to cast object of type 'System.Int64' to type 'System.String'." for the following line of code  if ((QSDealID) == (dr.GetString(1).ToString()))...............need ur help...Gurjeet,England First of all, the ToString of the GetString method is not needed because the GetString will return a string. The prolem with your code is that QSDealID is of type System.Int64, right? So a Int64 can't be compared with a string. The DataReader have a method that can return a Int64, so instead of using GetString(1), ...

Web resources about - System.Types and Point - embarcadero.delphi.general

Type system - Wikipedia, the free encyclopedia
A type system associates a type with each computed value. By examining the flow of these values, a type system attempts to ensure or prove that ...

Road code system for bushfire areas
... residents get back to their properties before roads are officially reopened to the general public. The new approach uses a colour-tier system ...

Company Shares of Cisco Systems, Inc. (NASDAQ:CSCO) Rally 4.23%
News Watch International Company Shares of Cisco Systems, Inc. (NASDAQ:CSCO) Rally 4.23% American Trade Journal Shares of Cisco Systems, Inc. ...

Cisco Systems victorious in multimillion dollar patent dispute
Business Insurance Cisco Systems victorious in multimillion dollar patent dispute Silicon Valley Business Journal Cisco Systems has won a ...

Massive storm system on the move as death toll climbs
System that brought twisters, ice, snow, floods to South and Midwest, killing at least 48, churning northeast; flooding fears mount along Mississippi ...

Rich shape tax system to save billions
The very richest Americans have financed a sophisticated and effective apparatus for shielding their fortunes. NYT reports.

Thousands Of Flights Canceled, Delayed As Storm System Wreaks Holiday Travel Havoc
Even if you haven’t had to fly anywhere yesterday or today, you’re likely aware that there’s a large storm system currently duffing up air travel ...

California's Shameful Bail System Needs To Go
... Attorney says the charges are dropped, but all that cash you just dropped on the bail bondsman is gone. That is California's bail system, rigged ...

Value of remote power systems expected to total nearly US$200 billion from 2015-2024, says Navigant
... and nanogrids in an off-grid environment mirrors the dynamics in a grid-tied environment in developed industrial economies, where the systems ...

Key Metrics Face-Off: Arista Networks vs. Cisco Systems
Key Metrics Face-Off: Arista Networks vs. Cisco Systems Motley Fool The two rivals are battling each other in court. But in the battle of financial ...

Resources last updated: 12/30/2015 6:33:40 AM