Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Putting Point into ArrayCtrl / How to get it back?
Putting Point into ArrayCtrl / How to get it back? [message #10811] Tue, 31 July 2007 09:28 Go to next message
zaurus is currently offline  zaurus
Messages: 42
Registered: May 2006
Member
Hi!

In my application I 'store' a Point variable in an array control. This works fine. Here is how the code roughly looks like.

Point p;
ArrayCtrl ac;

p = Point(50, 100);
ac.Add(p);

Now I want to read this data from the array control and then I get an error during runtime. It seems there is no conversion back, as the data is actually stored as a String in the array control.

p = Point(ac.GetColumn(0, 0));

Is there any function in U++ for the conversion?

Thanks for any short hints or comments.
Re: Putting Point into ArrayCtrl / How to get it back? [message #10813 is a reply to message #10811] Tue, 31 July 2007 11:33 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
See Core/Gtypes.h line 173.

The Point is stored as a Value in the ArrayCtrl and converted to a String only when displayed. To get it back you just have to do an explicit cast:
Point p = (Point) ac.GetColumn(0, 0);


James.
Re: Putting Point into ArrayCtrl / How to get it back? [message #10814 is a reply to message #10811] Tue, 31 July 2007 11:51 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
My quick guess would be:
p = Point((Point)ac.GetColumn(0, 0));
but I doubt if Point has something like Point(Point(x,y)) <= 1 arg
Why you just don't store x,y in separate columns?
Edit: I noticed James reply only after posted. He might be more correct though... Smile

[Updated on: Tue, 31 July 2007 11:56]

Report message to a moderator

Re: Putting Point into ArrayCtrl / How to get it back? [message #10819 is a reply to message #10811] Tue, 31 July 2007 13:03 Go to previous message
zaurus is currently offline  zaurus
Messages: 42
Registered: May 2006
Member
Hi James!

Thanks, it works fine.

I was actually searching around in Gtypes.h, but my knowledge seems to be not enough yet to understand all this. Need to read more about type casting.

Fudadmin, also thanks for your fast reply.

Zaurus
Previous Topic: serial port in u++
Next Topic: Extra callback needed in SliderCtrl
Goto Forum:
  


Current Time: Fri Apr 26 00:05:09 CEST 2024

Total time taken to generate the page: 0.08366 seconds