Label problem

answerme's Avatar, Join Date: Dec 2007
Ambitious contributor
Hi all
I am getting a error in creating a LABEL.I need to display different label at different positions
for the first time iam getting it perfectly alright.i.e. when iam placing a symbol in window its coming perfectly alright.But when Iam placing another symbol in window its getting hanged in Label->Create() function. Am I missing something.
Code:
if(td.L_Type==ENT_LAND)
	{
	ConvertLonLatToXY(td.L_Latitude,td.L_Longitude);// To get X,Y cordinates
	Label->Create(td.LandID, WS_OVERLAPPED|WS_CHILD|WS_DLGFRAME|WS_VISIBLE, 
        CRect(lx+10,ly,lx+55,ly+20), this, 0x188); // THIS IS WHERE SYSTEM GETS HANGED
                                                     //lx,ly value are correct it is giving different x & y value
	}
Gene Poole's Avatar, Join Date: Nov 2009
Contributor
What is "Label"? Where are lx and ly coming from? What is td.LandID?
answerme's Avatar, Join Date: Dec 2007
Ambitious contributor
Lable is
CStatic *Label = new CStatic;


lx & ly
Iam calling this function ConvertLonLatToXY(td.L_Latitude,td.L_Longitude) which is having 2 parameters i.e.strucutre in td latitude & longtitude ,with this 2 parameters i will get X & Y cordinates ie(X=lx & Y=ly)

td.LandID is string which i want to display
Gene Poole's Avatar, Join Date: Nov 2009
Contributor
Are you trying to create your CStatic more than once? Once it is created, you can change it's text by calling the SetWindowText() member function or you can move it to a new rectangle using the MoveWindow() member function. If you try to call Create on an object that is already created, it will fail.