Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Label problem (http://www.go4expert.com/forums/label-problem-t20776/)

answerme 27Jan2010 12:15

Label problem
 
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 27Jan2010 21:47

Re: Label problem
 
What is "Label"? Where are lx and ly coming from? What is td.LandID?

answerme 28Jan2010 09:24

Re: Label problem
 
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 29Jan2010 00:13

Re: Label problem
 
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.


All times are GMT +5.5. The time now is 04:41.